diff options
author | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2012-11-09 16:30:00 +0100 |
---|---|---|
committer | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2012-11-09 16:30:00 +0100 |
commit | 70505a987878885a02455ed2b42e40635e41cad0 (patch) | |
tree | 9ccf99d68eae6e19101a6876dde1f251d237d19e /trunk/pdf-over-gui/src/main/java | |
parent | d35a3edbc26fdd434e6b0b56666978db0bc86905 (diff) | |
download | pdf-over-70505a987878885a02455ed2b42e40635e41cad0.tar.gz pdf-over-70505a987878885a02455ed2b42e40635e41cad0.tar.bz2 pdf-over-70505a987878885a02455ed2b42e40635e41cad0.zip |
Fix for spaces in paths
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java')
-rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java index f93c7b5c..a7824f43 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTLoader.java +++ b/trunk/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/"; } |