diff options
author | tom-overton <tom.overton@outlook.com> | 2022-03-10 20:38:45 -0800 |
---|---|---|
committer | tom-overton <tom.overton@outlook.com> | 2022-03-10 20:38:45 -0800 |
commit | d60bd5d9fb64caf548e3456bbe3003ef37bac82f (patch) | |
tree | dfb4b6e23f2714849c7c4c6d0f6211d6d9b4de57 /src | |
parent | 1b5f26b34940fbb0ce6ac6213a444e9e1cb35b2e (diff) |
Fix issue where file paths with + in them would break the randomizer (fixes #400)
Diffstat (limited to 'src')
-rw-r--r-- | src/com/dabomstew/pkrandom/Utils.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/dabomstew/pkrandom/Utils.java b/src/com/dabomstew/pkrandom/Utils.java index 8417567..2fd8b71 100644 --- a/src/com/dabomstew/pkrandom/Utils.java +++ b/src/com/dabomstew/pkrandom/Utils.java @@ -117,7 +117,9 @@ public class Utils { public static File getExecutionLocation() throws UnsupportedEncodingException { URL location = NewRandomizerGUI.class.getProtectionDomain().getCodeSource().getLocation(); - return new File(java.net.URLDecoder.decode(location.getFile(), "UTF-8")); + String file = location.getFile(); + String plusEncoded = file.replaceAll("\\+", "%2b"); + return new File(java.net.URLDecoder.decode(plusEncoded, "UTF-8")); } public static class InvalidROMException extends Exception { |