File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ type Configuration struct {
39
39
// ArduinoIDEDirectory is the directory of the Arduino IDE if the CLI runs together with it.
40
40
ArduinoIDEDirectory * paths.Path
41
41
42
+ // IsPortable is set to true if the cli lives in IDE directory and the IDE is portable
43
+ IsPortable bool
44
+
42
45
// downloadsDir is the directory where the package files are downloaded and cached.
43
46
// Use DownloadsDir() method to retrieve it.
44
47
downloadsDir * paths.Path
Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ func (config *Configuration) IsBundledInDesktopIDE() bool {
62
62
}
63
63
}
64
64
65
+ portable := "portable"
66
+ if ideDir .Join (portable ).Exist () {
67
+ logrus .Info ("IDE is portable" )
68
+ config .IsPortable = true
69
+ }
70
+
65
71
config .ArduinoIDEDirectory = ideDir
66
72
res = true
67
73
return true
@@ -70,6 +76,10 @@ func (config *Configuration) IsBundledInDesktopIDE() bool {
70
76
// LoadFromDesktopIDEPreferences loads the config from the Desktop IDE preferences.txt file
71
77
func (config * Configuration ) LoadFromDesktopIDEPreferences () error {
72
78
logrus .Info ("Unserializing from IDE preferences" )
79
+ if config .IsPortable {
80
+ config .DataDir = config .ArduinoIDEDirectory .Join ("portable" )
81
+ config .SketchbookDir = config .ArduinoIDEDirectory .Join ("portable" ).Join ("sketchbook" )
82
+ }
73
83
preferenceTxtPath := config .DataDir .Join ("preferences.txt" )
74
84
props , err := properties .LoadFromPath (preferenceTxtPath )
75
85
if err != nil {
You can’t perform that action at this time.
0 commit comments