summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:20:18 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:20:18 +0000
commit00049cecb245046bc76f99548242f8fe3cf485f9 (patch)
tree91caba93bb5934a03cd02f9647897ec4264e691e
parent651d20960044fdc8e23a359e5712e8db8b5bd875 (diff)
downloadpdf-over-00049cecb245046bc76f99548242f8fe3cf485f9.tar.gz
pdf-over-00049cecb245046bc76f99548242f8fe3cf485f9.tar.bz2
pdf-over-00049cecb245046bc76f99548242f8fe3cf485f9.zip
Fix for spaces in paths
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@266 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java
index f93c7b5c..a7824f43 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java
@@ -17,9 +17,11 @@ package at.asit.pdfover.gui.utils;
// Imports
import java.io.File;
+import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
+import java.net.URLDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,10 +82,15 @@ public class SWTLoader {
}
private static String getSwtJarPath() {
- String path = SWTLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath();
- int idx = path.lastIndexOf('/');
- idx = path.lastIndexOf('/', idx - 1);
- path = path.substring(0, idx + 1);
+ String path = "";
+ try {
+ path = URLDecoder.decode(SWTLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath(), "UTF-8");
+ int idx = path.lastIndexOf('/');
+ idx = path.lastIndexOf('/', idx - 1);
+ path = path.substring(0, idx + 1);
+ } catch (UnsupportedEncodingException e) {
+ // Ignore
+ }
return path + "lib-swt/";
}