Skip to content

Commit a578ec8

Browse files
author
jantje
committed
Seems like a space in the eclipse iinstallation path results in error.
This provides us with a nicer message
1 parent ebafc60 commit a578ec8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
import java.nio.file.Paths;
77

88
import org.eclipse.core.runtime.IPath;
9+
import org.eclipse.core.runtime.IStatus;
910
import org.eclipse.core.runtime.Path;
1011
import org.eclipse.core.runtime.Platform;
12+
import org.eclipse.core.runtime.Status;
1113
import org.eclipse.core.runtime.preferences.ConfigurationScope;
1214
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
1315
import org.osgi.service.prefs.BackingStoreException;
@@ -45,16 +47,17 @@ public static Path getInstallationPath() {
4547
}
4648
String storedValue = getGlobalString(Const.KEY_MANAGER_DOWNLOAD_LOCATION, Const.EMPTY_STRING);
4749
if (storedValue.isEmpty()) {
48-
URI uri;
4950
try {
50-
uri = Platform.getInstallLocation().getURL().toURI();
51+
URI uri = Platform.getInstallLocation().getURL().toURI();
5152
String defaulDownloadLocation = Paths.get(uri).resolve("arduinoPlugin").toString(); //$NON-NLS-1$
5253
return new Path(defaulDownloadLocation);
5354
} catch (URISyntaxException e) {
5455
// this should not happen
55-
e.printStackTrace();
56+
// but it seems a space in the path makes it happen
57+
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$
59+
e));
5660
}
57-
5861
}
5962
return new Path(storedValue);
6063
}

0 commit comments

Comments
 (0)