From e4d79503360374243191d2a1ba2a8bff0c82a269 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Wed, 8 Nov 2017 19:45:06 -0500 Subject: [PATCH 1/2] Ripme now runs in portable mode if in the same dir as a rip.properties file --- .../java/com/rarchives/ripme/utils/Utils.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/com/rarchives/ripme/utils/Utils.java b/src/main/java/com/rarchives/ripme/utils/Utils.java index 7a34e6e3..e9458223 100644 --- a/src/main/java/com/rarchives/ripme/utils/Utils.java +++ b/src/main/java/com/rarchives/ripme/utils/Utils.java @@ -164,7 +164,29 @@ public class Utils { + File.separator + "Library" + File.separator + "Application Support" + File.separator + "ripme"; } + private static boolean portableMode() { + try { + File f = new File(new File(".").getCanonicalPath() + File.separator + configFile); + if(f.exists() && !f.isDirectory()) { + return true; + } + } catch (IOException e) { + return false; + } + return false; + } + + public static String getConfigDir() { + if (portableMode()) { + logger.info("Running in portable mode"); + try { + return new File(".").getCanonicalPath(); + } catch (Exception e) { + return "."; + } + } + if (isWindows()) return getWindowsConfigDir(); if (isMacOS()) return getMacOSConfigDir(); if (isUnix()) return getUnixConfigDir(); From 9302e0be35264fe61ee4836052b8ea50a7f37c0d Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Wed, 8 Nov 2017 19:54:00 -0500 Subject: [PATCH 2/2] Removed debugging statement --- src/main/java/com/rarchives/ripme/utils/Utils.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/rarchives/ripme/utils/Utils.java b/src/main/java/com/rarchives/ripme/utils/Utils.java index e9458223..b0d281d7 100644 --- a/src/main/java/com/rarchives/ripme/utils/Utils.java +++ b/src/main/java/com/rarchives/ripme/utils/Utils.java @@ -179,7 +179,6 @@ public class Utils { public static String getConfigDir() { if (portableMode()) { - logger.info("Running in portable mode"); try { return new File(".").getCanonicalPath(); } catch (Exception e) {