Skip to content

Commit 5b975d5

Browse files
committed
workaround for spaces in path (not yet tested with spaces)
as to http://stackoverflow.com/questions/14676966/escape-result-of-filelocator-resolveurl
1 parent b3af208 commit 5b975d5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

it.baeyens.arduino.common/src/it/baeyens/arduino/common/ConfigurationPreferences.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.File;
44
import java.net.URI;
55
import java.net.URISyntaxException;
6+
import java.net.URL;
67
import java.nio.file.Paths;
78

89
import org.eclipse.core.runtime.IPath;
@@ -48,14 +49,15 @@ public static Path getInstallationPath() {
4849
String storedValue = getGlobalString(Const.KEY_MANAGER_DOWNLOAD_LOCATION, Const.EMPTY_STRING);
4950
if (storedValue.isEmpty()) {
5051
try {
51-
URI uri = Platform.getInstallLocation().getURL().toURI();
52-
String defaulDownloadLocation = Paths.get(uri).resolve("arduinoPlugin").toString(); //$NON-NLS-1$
52+
URL resolvedUrl = Platform.getInstallLocation().getURL();
53+
URI resolvedUri = new URI(resolvedUrl.getProtocol(), resolvedUrl.getPath(), null);
54+
String defaulDownloadLocation = Paths.get(resolvedUri).resolve("arduinoPlugin").toString(); //$NON-NLS-1$
5355
return new Path(defaulDownloadLocation);
5456
} catch (URISyntaxException e) {
5557
// this should not happen
5658
// but it seems a space in the path makes it happen
5759
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID,
58-
"Eclipse fails to provide its own installation folder :-(. \nThis is know to happen when you have a space in your eclipse installation path", //$NON-NLS-1$
60+
"Eclipse fails to provide its own installation folder :-(. \nThis is know to happen when you have a space ! # or other wierd characters in your eclipse installation path", //$NON-NLS-1$
5961
e));
6062
}
6163
}

0 commit comments

Comments
 (0)