Skip to content

Commit da3cd7f

Browse files
author
Massimiliano Pippi
committed
fix IsBundledInDesktopIDE logic
1 parent daf030b commit da3cd7f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Diff for: configuration/configuration.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,27 @@ func IsBundledInDesktopIDE() bool {
151151

152152
ideDir := filepath.Dir(executablePath)
153153

154-
// We check an arbitrary number of folders that are part of the IDE
155-
// install tree
154+
// To determine if the CLI is bundled with an IDE, We check an arbitrary
155+
// number of folders that are part of the IDE install tree
156156
tests := []string{
157157
"tools-builder",
158158
"examples/01.Basics/Blink",
159-
"portable",
160159
}
161160

162161
for _, test := range tests {
163162
if _, err := os.Stat(filepath.Join(ideDir, test)); err != nil {
164163
// the test folder doesn't exist or is not accessible
165164
return viper.GetBool("IDE.Bundled")
166165
}
166+
}
167167

168-
if test == "portable" {
169-
viper.Set("IDE.Portable", true)
170-
}
168+
// Check whether this is a portable install
169+
if _, err := os.Stat(filepath.Join(ideDir, "portable")); err != nil {
170+
viper.Set("IDE.Portable", true)
171171
}
172172

173+
// Persist IDE-related config settings and return true
174+
viper.Set("IDE.Bundled", false)
173175
viper.Set("IDE.Directory", ideDir)
174176
return true
175177
}

0 commit comments

Comments
 (0)