Skip to content

Commit

Permalink
Use OS specific path delimiters (to make esp32 V3.0.7 work
Browse files Browse the repository at this point in the history
Use toOSString instead of toString
Introduce the global variable PATH_SEPERATOR
Use ${PathDelimiter} or PATH_SEPERATOR instead of /
This also requires a new version string for the sloeber.txt file
  • Loading branch information
jan committed Nov 23, 2024
1 parent 39b0ec7 commit 9559d84
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ static public String GetNiceFileName(IFolder buildPath, IFile path) {
static public String GetNiceFileName(IPath buildPath, IPath filePath) {
String ret;
if (buildPath.isPrefixOf(filePath) || buildPath.removeLastSegments(3).isPrefixOf(filePath)) {
ret = filePath.makeRelativeTo(buildPath).toString();
ret = filePath.makeRelativeTo(buildPath).toOSString();
} else {
ret = filePath.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public String getPathExtension() {

@Override
public String getDiscoveryCommand(ToolType toolType) {
return getToolLocation().append( getCommand(toolType)).toString() + DISCOVERY_PARAMETERS;
return getToolLocation().append( getCommand(toolType)).toOSString() + DISCOVERY_PARAMETERS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public String getPathExtension() {

@Override
public String getDiscoveryCommand(ToolType toolType) {
return getToolLocation().append( getCommand(toolType)).toString() +DISCOVERY_PARAMETERS;
return getToolLocation().append( getCommand(toolType)).toOSString() +DISCOVERY_PARAMETERS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public String[] getRecipes(IFolder buildFolder, AutoBuildConfigurationDescriptio
IFile file = project.getWorkspace().getRoot()
.getFile(IPath.forPosix(curEntry.getValue()));
includeFiles = includeFiles + WHITESPACE + DOUBLE_QUOTE + CMD_LINE_INCLUDE_FILE
+ file.getLocation().toString() + DOUBLE_QUOTE;
+ file.getLocation().toOSString() + DOUBLE_QUOTE;
break;
}
case ICSettingEntry.INCLUDE_PATH: {
Expand All @@ -300,7 +300,7 @@ public String[] getRecipes(IFolder buildFolder, AutoBuildConfigurationDescriptio

}else {
includePath = includePath + WHITESPACE + DOUBLE_QUOTE + CMD_LINE_INCLUDE_FOLDER
+ path.toString() + DOUBLE_QUOTE;
+ path.toOSString() + DOUBLE_QUOTE;
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class AutoBuildConstants {
public static final String PROCENT = "%";
public static final String SLACH = "/";
public static final String BACKSLACH = "\\";
public static final String PATH_SEPERATOR=isWindows?BACKSLACH:SLACH;
public static final String FALSE = "FALSE";
public static final String TRUE = "TRUE";
public static final String COLON = ":";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ public String[] getRecipes(IAutoBuildConfigurationDescription autoBuildConfData,
IPath toolPath = buildTools.getToolLocation();
if (toolPath != null && !toolPath.toString().isBlank()) {
//store the path
toolCommandVars.put(CMD_LINE_TOOL_PATH, toolPath.toString().trim() + SLACH);
toolCommandVars.put(CMD_LINE_TOOL_PATH, toolPath.toOSString().trim() + PATH_SEPERATOR);
}
Map<String, String> toolVariables = buildTools.getToolVariables();
if (toolVariables != null && toolVariables.size() > 0) {
Expand Down
2 changes: 1 addition & 1 deletion io.sloeber.core/config/pre_processing_platform_default.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#this file contains default/fallback/rescue values
software=ARDUINO
archive_file=arduino.ar
archive_file_path=${build.path}/${archive_file}
archive_file_path=${build.path}${PathDelimiter}${archive_file}
ide_version=20302

serial.port=${com_port}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import io.sloeber.core.txt.TxtFile;

public class BoardDescription {
private static final String FIRST_SLOEBER_LINE = "#Sloeber created file please do not modify V1.00.test 06 "; //$NON-NLS-1$
private static final String FIRST_SLOEBER_LINE = "#Sloeber created file please do not modify V1.00.test 07 "; //$NON-NLS-1$
private static final IEclipsePreferences myStorageNode = InstanceScope.INSTANCE.getNode(NODE_ARDUINO);

/*
Expand Down Expand Up @@ -1072,7 +1072,7 @@ private Map<String, String> getEnvVarPlatformFileTools(IArduinoPlatformVersion p
for (ArduinoPlatformTooldDependency tool : platformVersion.getToolsDependencies()) {
IPath installPath = tool.getInstallPath();
if (installPath.toFile().exists()) {
String value = installPath.toString();
String value = installPath.toOSString();
String keyString = ENV_KEY_RUNTIME_TOOLS + tool.getName() + tool.getVersion() + DOT_PATH;
vars = vars + NEWLINE + keyString + EQUAL + value;
keyString = ENV_KEY_RUNTIME_TOOLS + tool.getName() + '-' + tool.getVersion() + DOT_PATH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ private static IStatus uninstall(IArduinoPlatformVersion curPlatform) {
deleteDirectory(installFolder);
envVarsNeedUpdating = true;
} catch (IOException e) {
return new Status(IStatus.ERROR, Activator.getId(), "Failed to remove folder" + installFolder.toString(), //$NON-NLS-1$
return new Status(IStatus.ERROR, Activator.getId(), "Failed to remove folder" + installFolder.toOSString(), //$NON-NLS-1$
e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public static IStatus unInstall(IArduinoLibraryVersion lib, IProgressMonitor mon
deleteDirectory(lib.getInstallPath().removeLastSegments(1));
} catch (IOException e) {
return new Status(IStatus.ERROR, Activator.getId(),
"Failed to remove folder" + lib.getInstallPath().toString(), //$NON-NLS-1$
"Failed to remove folder" + lib.getInstallPath().toOSString(), //$NON-NLS-1$
e);
}

Expand Down
4 changes: 2 additions & 2 deletions io.sloeber.core/src/io/sloeber/core/api/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Common {

public final static String sloeberHome = getSloeberHome();
public final static IPath sloeberHomePath = new org.eclipse.core.runtime.Path(sloeberHome);
public final static String sloeberHomePathToString = sloeberHomePath.toString();
public final static String sloeberHomePathToString = sloeberHomePath.toOSString();

private static String getSloeberHome() {

Expand Down Expand Up @@ -213,7 +213,7 @@ public static IPath getWorkspaceRoot() {
*/
public static String makePathVersionString(File file) {
if(sloeberHomePath.isPrefixOf(IPath.fromFile(file))) {
return SLOEBER_HOME_VAR+SLACH+IPath.fromFile(file) .makeRelativeTo(sloeberHomePath).toString();
return SLOEBER_HOME_VAR+SLACH+IPath.fromFile(file).makeRelativeTo(sloeberHomePath).toString();
}
return file.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ public static File getPostProcessingBoardsFile() {
}

public static Path getMakePath() {
return new Path(getInstallationPath().append("tools/make").toString()); //$NON-NLS-1$
return new Path(getInstallationPath().append("tools/make").toOSString()); //$NON-NLS-1$

}

public static IPath getAwkPath() {
return new Path(getInstallationPath().append("tools/awk").toString()); //$NON-NLS-1$
return new Path(getInstallationPath().append("tools/awk").toOSString()); //$NON-NLS-1$
}

public static Instant getLatestJsonUpdateTime() {
Expand Down
4 changes: 2 additions & 2 deletions io.sloeber.core/src/io/sloeber/core/api/Defaults.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ public static String getPrivateLibraryPath() {
if (isMac || isWindows) {
homPath = homPath.append("Documents");
}
return homPath.append("Arduino").append(ARDUINO_LIBRARY_FOLDER_NAME).toString();
return homPath.append("Arduino").append(ARDUINO_LIBRARY_FOLDER_NAME).toOSString();
}

public static String getPrivateHardwarePath() {
IPath homPath = new Path(System.getProperty("user.home"));
if (isMac || isWindows) {
homPath = homPath.append("Documents");
}
return homPath.append("Arduino").append(ARDUINO_HARDWARE_FOLDER_NAME).toString();
return homPath.append("Arduino").append(ARDUINO_HARDWARE_FOLDER_NAME).toOSString();
}

public static String getDefaultDisconnectSerialTargets() {
Expand Down

0 comments on commit 9559d84

Please sign in to comment.