File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ type Configuration struct {
3939 // ArduinoIDEDirectory is the directory of the Arduino IDE if the CLI runs together with it.
4040 ArduinoIDEDirectory * paths.Path
4141
42+ // IsPortable is set to true if the cli lives in IDE directory and the IDE is portable
43+ IsPortable bool
44+
4245 // downloadsDir is the directory where the package files are downloaded and cached.
4346 // Use DownloadsDir() method to retrieve it.
4447 downloadsDir * paths.Path
Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ func (config *Configuration) IsBundledInDesktopIDE() bool {
6262 }
6363 }
6464
65+ portable := "portable"
66+ if ideDir .Join (portable ).Exist () {
67+ logrus .Info ("IDE is portable" )
68+ config .IsPortable = true
69+ }
70+
6571 config .ArduinoIDEDirectory = ideDir
6672 res = true
6773 return true
@@ -70,6 +76,10 @@ func (config *Configuration) IsBundledInDesktopIDE() bool {
7076// LoadFromDesktopIDEPreferences loads the config from the Desktop IDE preferences.txt file
7177func (config * Configuration ) LoadFromDesktopIDEPreferences () error {
7278 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+ }
7383 preferenceTxtPath := config .DataDir .Join ("preferences.txt" )
7484 props , err := properties .LoadFromPath (preferenceTxtPath )
7585 if err != nil {
You can’t perform that action at this time.
0 commit comments