diff --git a/org.eclipse.corrosion/src/org/eclipse/corrosion/debug/RustDebugDelegate.java b/org.eclipse.corrosion/src/org/eclipse/corrosion/debug/RustDebugDelegate.java index 299c25e..de767d8 100644 --- a/org.eclipse.corrosion/src/org/eclipse/corrosion/debug/RustDebugDelegate.java +++ b/org.eclipse.corrosion/src/org/eclipse/corrosion/debug/RustDebugDelegate.java @@ -57,7 +57,7 @@ public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IPr IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); String workingDirectoryString = RustLaunchDelegateTools.performVariableSubstitution( configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, "").trim()); //$NON-NLS-1$ - File workingDirectory = RustLaunchDelegateTools.convertToAbsolutePath(new File(workingDirectoryString)); + File workingDirectory = RustLaunchDelegateTools.convertToAbsolutePath(workingDirectoryString); if (workingDirectoryString.isEmpty() || !workingDirectory.exists() || !workingDirectory.isDirectory()) { workingDirectory = project.getLocation().toFile(); } @@ -150,13 +150,13 @@ public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); String workingDirectoryString = RustLaunchDelegateTools.performVariableSubstitution( configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, "").trim()); //$NON-NLS-1$ - File workingDirectory = RustLaunchDelegateTools.convertToAbsolutePath(new File(workingDirectoryString)); + File workingDirectory = RustLaunchDelegateTools.convertToAbsolutePath(workingDirectoryString); if (workingDirectoryString.isEmpty() || !workingDirectory.exists() || !workingDirectory.isDirectory()) { workingDirectory = project.getLocation().toFile(); } String executableString = RustLaunchDelegateTools.performVariableSubstitution( configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "").trim()); //$NON-NLS-1$ - File executable = RustLaunchDelegateTools.convertToAbsolutePath(new File(executableString)); + File executable = RustLaunchDelegateTools.convertToAbsolutePath(executableString); ILaunchConfigurationWorkingCopy wc = configuration.copy(configuration.getName() + "[Variables Parsed]") //$NON-NLS-1$ .getWorkingCopy(); diff --git a/org.eclipse.corrosion/src/org/eclipse/corrosion/launch/RustLaunchDelegateTools.java b/org.eclipse.corrosion/src/org/eclipse/corrosion/launch/RustLaunchDelegateTools.java index be1ffd0..ad52677 100644 --- a/org.eclipse.corrosion/src/org/eclipse/corrosion/launch/RustLaunchDelegateTools.java +++ b/org.eclipse.corrosion/src/org/eclipse/corrosion/launch/RustLaunchDelegateTools.java @@ -83,10 +83,19 @@ public static IResource resourceFromEditor(IEditorPart editor) { return input.getAdapter(IResource.class); } - public static File convertToAbsolutePath(File file) { + /** + * Converts the given relative path to a workspace resource and converts it to a + * {@code File} with the absolute path on the file system. + * + * @param path to a workspace resource + * @return File object of the given {@code path}, with an absolute path on the + * file system + */ + public static File convertToAbsolutePath(String path) { + final File file = new File(path); if (file.isAbsolute()) return file; - return ResourcesPlugin.getWorkspace().getRoot().getLocation().append(file.getPath()).toFile(); + return ResourcesPlugin.getWorkspace().getRoot().findMember(file.getPath()).getRawLocation().toFile(); } /** diff --git a/org.eclipse.corrosion/src/org/eclipse/corrosion/run/CargoRunDelegate.java b/org.eclipse.corrosion/src/org/eclipse/corrosion/run/CargoRunDelegate.java index c04574c..e7eb07c 100644 --- a/org.eclipse.corrosion/src/org/eclipse/corrosion/run/CargoRunDelegate.java +++ b/org.eclipse.corrosion/src/org/eclipse/corrosion/run/CargoRunDelegate.java @@ -69,7 +69,7 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun String arguments = configuration.getAttribute(RustLaunchDelegateTools.ARGUMENTS_ATTRIBUTE, "").trim(); //$NON-NLS-1$ String workingDirectoryString = RustLaunchDelegateTools.performVariableSubstitution( configuration.getAttribute(RustLaunchDelegateTools.WORKING_DIRECTORY_ATTRIBUTE, "").trim()); //$NON-NLS-1$ - File workingDirectory = RustLaunchDelegateTools.convertToAbsolutePath(new File(workingDirectoryString)); + File workingDirectory = RustLaunchDelegateTools.convertToAbsolutePath(workingDirectoryString); if (workingDirectoryString.isEmpty() || !workingDirectory.exists() || !workingDirectory.isDirectory()) { workingDirectory = project.getLocation().toFile(); } diff --git a/org.eclipse.corrosion/src/org/eclipse/corrosion/test/CargoTestDelegate.java b/org.eclipse.corrosion/src/org/eclipse/corrosion/test/CargoTestDelegate.java index 37d9240..157ae41 100644 --- a/org.eclipse.corrosion/src/org/eclipse/corrosion/test/CargoTestDelegate.java +++ b/org.eclipse.corrosion/src/org/eclipse/corrosion/test/CargoTestDelegate.java @@ -62,7 +62,7 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun String arguments = configuration.getAttribute(RustLaunchDelegateTools.ARGUMENTS_ATTRIBUTE, "").trim(); //$NON-NLS-1$ String workingDirectoryString = RustLaunchDelegateTools.performVariableSubstitution( configuration.getAttribute(RustLaunchDelegateTools.WORKING_DIRECTORY_ATTRIBUTE, "").trim()); //$NON-NLS-1$ - File workingDirectory = RustLaunchDelegateTools.convertToAbsolutePath(new File(workingDirectoryString)); + File workingDirectory = RustLaunchDelegateTools.convertToAbsolutePath(workingDirectoryString); if (workingDirectoryString.isEmpty() || !workingDirectory.exists() || !workingDirectory.isDirectory()) { workingDirectory = null; }