Skip to content

Commit

Permalink
Fixing issues with library location when the jar is in a path that co…
Browse files Browse the repository at this point in the history
…ntains spaces. Resolves issue #369. (#370)
  • Loading branch information
kwhat authored Oct 13, 2021
1 parent b195b43 commit afc59a6
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.ArrayList;
Expand Down Expand Up @@ -65,9 +66,16 @@ public Iterator<File> getLibraries() {

URL classLocation = GlobalScreen.class.getProtectionDomain().getCodeSource().getLocation();

File classFile = null;
try {
classFile = new File(classLocation.toURI());
}
catch (URISyntaxException e) {
log.warning(e.getMessage());
classFile = new File(classLocation.getPath());
}

File libFile = null;
File classFile = new File(classLocation.getPath());

if (classFile.isFile()) {
// Jar Archive
String libPath = classFile.getParentFile().getPath();
Expand Down

0 comments on commit afc59a6

Please sign in to comment.