v0.5.1 Fixing bug when JAR located in folder that have in name national characters or/and space(s) doesn't executes.

This commit is contained in:
Dmitry Isaenko 2019-06-16 16:26:48 +03:00
parent aad5a1c38e
commit 0bfdd1f579
3 changed files with 13 additions and 4 deletions

View file

@ -8,7 +8,7 @@
<name>NS-USBloader</name> <name>NS-USBloader</name>
<artifactId>ns-usbloader</artifactId> <artifactId>ns-usbloader</artifactId>
<version>0.5-SNAPSHOT</version> <version>0.5.1-SNAPSHOT</version>
<url>https://github.com/developersu/ns-usbloader/</url> <url>https://github.com/developersu/ns-usbloader/</url>
<description> <description>

View file

@ -15,7 +15,9 @@ import nsusbloader.ModelControllers.UpdatesChecker;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder;
import java.util.*; import java.util.*;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
@ -194,9 +196,16 @@ public class SettingsController implements Initializable {
ObservableList<String> langCBObsList = FXCollections.observableArrayList(); ObservableList<String> langCBObsList = FXCollections.observableArrayList();
langCBObsList.add("eng"); langCBObsList.add("eng");
File jarFile = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()); File jarFile;
try{
jarFile = new File(URLDecoder.decode(getClass().getProtectionDomain().getCodeSource().getLocation().getPath(), "utf-8"));
}
catch (UnsupportedEncodingException uee){
uee.printStackTrace();
jarFile = null;
}
if(jarFile.isFile()) { // Run with JAR file if(jarFile != null && jarFile.isFile()) { // Run with JAR file
try { try {
JarFile jar = new JarFile(jarFile); JarFile jar = new JarFile(jarFile);
Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar

View file

@ -12,7 +12,7 @@ import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;
public class NSLMain extends Application { public class NSLMain extends Application {
public static final String appVersion = "v0.5"; public static final String appVersion = "v0.5.1";
@Override @Override
public void start(Stage primaryStage) throws Exception{ public void start(Stage primaryStage) throws Exception{