summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortom-overton <tom.overton@outlook.com>2022-03-10 20:38:45 -0800
committertom-overton <tom.overton@outlook.com>2022-03-10 20:38:45 -0800
commitd60bd5d9fb64caf548e3456bbe3003ef37bac82f (patch)
treedfb4b6e23f2714849c7c4c6d0f6211d6d9b4de57 /src
parent1b5f26b34940fbb0ce6ac6213a444e9e1cb35b2e (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.java4
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 {