Skip to content

Commit 2b1cfdd

Browse files
committed
Add runtime.ide.path env variable
Partially fixes arduino/Arduino#7160
1 parent ffe9669 commit 2b1cfdd

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: constants/constants.go

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const BUILD_PROPERTIES_PATTERN = "pattern"
6666
const BUILD_PROPERTIES_PID = "pid"
6767
const BUILD_PROPERTIES_PREPROCESSED_FILE_PATH = "preprocessed_file_path"
6868
const BUILD_PROPERTIES_RUNTIME_HARDWARE_PATH = "runtime.hardware.path"
69+
const BUILD_PROPERTIES_RUNTIME_IDE_PATH = "runtime.ide.path"
6970
const BUILD_PROPERTIES_RUNTIME_OS = "runtime.os"
7071
const BUILD_PROPERTIES_RUNTIME_PLATFORM_PATH = "runtime.platform.path"
7172
const BUILD_PROPERTIES_RUNTIME_TOOLS_PREFIX = "runtime.tools."

Diff for: setup_build_properties.go

+9
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
package builder
3131

3232
import (
33+
"os"
3334
"path/filepath"
3435
"strconv"
3536
"strings"
@@ -64,12 +65,20 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
6465
}
6566
buildProperties[constants.BUILD_PROPERTIES_BUILD_ARCH] = strings.ToUpper(targetPlatform.PlatformId)
6667

68+
// get base folder and use it to populate BUILD_PROPERTIES_RUNTIME_IDE_PATH (arduino and arduino-builder live in the same dir)
69+
ex, err := os.Executable()
70+
exPath := ""
71+
if err == nil {
72+
exPath = filepath.Dir(ex)
73+
}
74+
6775
buildProperties[constants.BUILD_PROPERTIES_BUILD_CORE] = ctx.BuildCore
6876
buildProperties[constants.BUILD_PROPERTIES_BUILD_CORE_PATH] = filepath.Join(actualPlatform.Folder, constants.FOLDER_CORES, buildProperties[constants.BUILD_PROPERTIES_BUILD_CORE])
6977
buildProperties[constants.BUILD_PROPERTIES_BUILD_SYSTEM_PATH] = filepath.Join(actualPlatform.Folder, constants.FOLDER_SYSTEM)
7078
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_PLATFORM_PATH] = targetPlatform.Folder
7179
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_HARDWARE_PATH] = filepath.Join(targetPlatform.Folder, "..")
7280
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = ctx.ArduinoAPIVersion
81+
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_IDE_PATH] = exPath
7382
buildProperties[constants.BUILD_PROPERTIES_FQBN] = ctx.FQBN
7483
buildProperties[constants.IDE_VERSION] = ctx.ArduinoAPIVersion
7584
buildProperties[constants.BUILD_PROPERTIES_RUNTIME_OS] = utils.PrettyOSName()

0 commit comments

Comments
 (0)