@@ -48,24 +48,26 @@ export class ArduinoSettings implements IArduinoSettings {
48
48
this . _commandPath = "arduino_debug.exe" ;
49
49
}
50
50
} else if ( platform === "linux" ) {
51
- this . _packagePath = path . join ( process . env . HOME , ".arduino15" ) ;
51
+ if ( util . directoryExistsSync ( path . join ( this . _arduinoPath , "portable" ) ) ) {
52
+ this . _packagePath = path . join ( this . _arduinoPath , "portable" ) ;
53
+ } else {
54
+ this . _packagePath = path . join ( process . env . HOME , ".arduino15" ) ;
55
+ }
52
56
this . _sketchbookPath = this . preferences . get ( "sketchbook.path" ) || path . join ( process . env . HOME , "Arduino" ) ;
53
57
if ( this . _commandPath === "" ) {
54
58
this . _commandPath = "arduino" ;
55
59
}
56
60
} else if ( platform === "darwin" ) {
57
- this . _packagePath = path . join ( process . env . HOME , "Library/Arduino15" ) ;
61
+ if ( util . directoryExistsSync ( path . join ( this . _arduinoPath , "portable" ) ) ) {
62
+ this . _packagePath = path . join ( this . _arduinoPath , "portable" ) ;
63
+ } else {
64
+ this . _packagePath = path . join ( process . env . HOME , "Library/Arduino15" ) ;
65
+ }
58
66
this . _sketchbookPath = this . preferences . get ( "sketchbook.path" ) || path . join ( process . env . HOME , "Documents/Arduino" ) ;
59
67
if ( this . _commandPath === "" ) {
60
68
this . _commandPath = "/Contents/MacOS/Arduino" ;
61
69
}
62
70
}
63
-
64
- // Arduino IDE will save all packages into portable folder if it exsits.
65
- // https://github.com/Microsoft/vscode-arduino/issues/415
66
- if ( ! util . directoryExistsSync ( this . _packagePath ) && util . directoryExistsSync ( path . join ( this . _arduinoPath , "portable" ) ) ) {
67
- this . _packagePath = path . join ( this . _arduinoPath , "portable" ) ;
68
- }
69
71
}
70
72
71
73
public get arduinoPath ( ) : string {
@@ -150,7 +152,9 @@ export class ArduinoSettings implements IArduinoSettings {
150
152
folder = folder . replace ( / % ( [ ^ % ] + ) % / g, ( match , p1 ) => {
151
153
return process . env [ p1 ] ;
152
154
} ) ;
153
- if ( util . fileExistsSync ( path . join ( this . _arduinoPath , "AppxManifest.xml" ) ) ) {
155
+ if ( util . directoryExistsSync ( path . join ( this . _arduinoPath , "portable" ) ) ) {
156
+ this . _packagePath = path . join ( this . _arduinoPath , "portable" ) ;
157
+ } else if ( util . fileExistsSync ( path . join ( this . _arduinoPath , "AppxManifest.xml" ) ) ) {
154
158
this . _packagePath = path . join ( folder , "ArduinoData" ) ;
155
159
} else {
156
160
this . _packagePath = path . join ( process . env . LOCALAPPDATA , "Arduino15" ) ;
0 commit comments