File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
io.sloeber.core/src/io/sloeber/core/api Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -697,7 +697,7 @@ public BoardDescription(Map<String, String> envVars) {
697
697
myBoardID = value ;
698
698
break ;
699
699
case KEY_SLOEBER_BOARD_TXT :
700
- myUserSelectedBoardsTxtFile = new File (value );
700
+ myUserSelectedBoardsTxtFile = resolvePathEnvironmentString ( new File (value ) );
701
701
mySloeberBoardTxtFile = new BoardTxtFile (myUserSelectedBoardsTxtFile );
702
702
break ;
703
703
case KEY_SLOEBER_UPLOAD_PORT :
@@ -822,7 +822,7 @@ public Map<String, String> getEnvVars() {
822
822
}
823
823
allVars .put (ENV_KEY_SOFTWARE ,VENDOR_ARDUINO );
824
824
allVars .put (ENV_KEY_ID ,getBoardID ());
825
-
825
+
826
826
827
827
828
828
allVars .put (ENV_KEY_SERIAL_PORT , getActualUploadPort ());
Original file line number Diff line number Diff line change @@ -228,16 +228,15 @@ public static IPath getWorkspaceRoot() {
228
228
* Check whether the string starts with the SLOEBER_HOME path If it does replace
229
229
* with environment variable This keeps things more compatible over environments
230
230
*
231
- * @param path
231
+ * @param file
232
232
* string to check
233
233
* @return modified string or the original
234
234
*/
235
- public static String makePathEnvironmentString (IPath path ) {
236
- return path .toOSString ().replace (sloeberHomePathToString , SLOEBER_HOME_VAR );
237
- }
238
-
239
235
public static String makePathVersionString (File file ) {
240
- return file .getPath ().replace (sloeberHomePathToString , SLOEBER_HOME_VAR );
236
+ if (sloeberHomePath .isPrefixOf (IPath .fromFile (file ))) {
237
+ return SLOEBER_HOME_VAR +SLACH +IPath .fromFile (file ) .makeRelativeTo (sloeberHomePath ).toString ();
238
+ }
239
+ return file .toString ();
241
240
}
242
241
243
242
/**
@@ -247,7 +246,13 @@ public static String makePathVersionString(File file) {
247
246
* @return
248
247
*/
249
248
public static File resolvePathEnvironmentString (File file ) {
250
- String retString = file .getPath ().replace (SLOEBER_HOME_VAR , sloeberHomePathToString );
249
+
250
+ String retString = file .getPath ();
251
+ if (retString .startsWith (SLOEBER_HOME_VAR )) {
252
+ retString =retString .replace (SLOEBER_HOME_VAR , EMPTY_STRING );
253
+ return sloeberHomePath .append (retString ).toFile ();
254
+ //.replace(SLOEBER_HOME_VAR, sloeberHomePathToString);
255
+ }
251
256
return new File (retString );
252
257
}
253
258
You can’t perform that action at this time.
0 commit comments