@@ -56,11 +56,7 @@ export class ArduinoSettings implements IArduinoSettings {
56
56
57
57
public get defaultExamplePath ( ) : string {
58
58
if ( os . platform ( ) === "darwin" ) {
59
- if ( this . _arduinoPath . match ( / A r d u i n o .* \. a p p / ) ) {
60
- return path . join ( this . _arduinoPath , "/Contents/Java/examples" ) ;
61
- } else {
62
- return path . join ( this . _arduinoPath , "Arduino.app/Contents/Java/examples" ) ;
63
- }
59
+ return path . join ( util . resolveMacArduinoAppPath ( this . _arduinoPath ) , "/Contents/Java/examples" ) ;
64
60
} else {
65
61
return path . join ( this . _arduinoPath , "examples" ) ;
66
62
}
@@ -72,23 +68,15 @@ export class ArduinoSettings implements IArduinoSettings {
72
68
73
69
public get defaultPackagePath ( ) : string {
74
70
if ( os . platform ( ) === "darwin" ) {
75
- if ( this . _arduinoPath . match ( / A r d u i n o .* \. a p p / ) ) {
76
- return path . join ( this . _arduinoPath , "/Contents/Java/hardware" ) ;
77
- } else {
78
- return path . join ( this . _arduinoPath , "Arduino.app/Contents/Java/hardware" ) ;
79
- }
71
+ return path . join ( util . resolveMacArduinoAppPath ( this . _arduinoPath ) , "/Contents/Java/hardware" ) ;
80
72
} else { // linux and win32.
81
73
return path . join ( this . _arduinoPath , "hardware" ) ;
82
74
}
83
75
}
84
76
85
77
public get defaultLibPath ( ) : string {
86
78
if ( os . platform ( ) === "darwin" ) {
87
- if ( this . _arduinoPath . match ( / A r d u i n o .* \. a p p / ) ) {
88
- return path . join ( this . _arduinoPath , "/Contents/Java/libraries" ) ;
89
- } else {
90
- return path . join ( this . _arduinoPath , "Arduino.app/Contents/Java/libraries" ) ;
91
- }
79
+ return path . join ( util . resolveMacArduinoAppPath ( this . _arduinoPath ) , "/Contents/Java/libraries" ) ;
92
80
} else { // linux and win32
93
81
return path . join ( this . _arduinoPath , "libraries" ) ;
94
82
}
@@ -97,11 +85,7 @@ export class ArduinoSettings implements IArduinoSettings {
97
85
public get commandPath ( ) : string {
98
86
const platform = os . platform ( ) ;
99
87
if ( platform === "darwin" ) {
100
- if ( this . _arduinoPath . match ( / A r d u i n o .* \. a p p / ) ) {
101
- return path . join ( this . _arduinoPath , path . normalize ( "/Contents/MacOS/Arduino" ) ) ;
102
- } else {
103
- return path . join ( this . _arduinoPath , path . normalize ( "Arduino.app/Contents/MacOS/Arduino" ) ) ;
104
- }
88
+ return path . join ( util . resolveMacArduinoAppPath ( this . _arduinoPath ) , path . normalize ( "/Contents/MacOS/Arduino" ) ) ;
105
89
} else if ( platform === "linux" ) {
106
90
return path . join ( this . _arduinoPath , "arduino" ) ;
107
91
} else if ( platform === "win32" ) {
0 commit comments