Skip to content

Commit

Permalink
fix: BaseDirectories library crash on Windows10. Provide alternative …
Browse files Browse the repository at this point in the history
…path lookup
  • Loading branch information
Col-E committed Nov 30, 2020
1 parent 16d2834 commit 96dfcf1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>me.coley</groupId>
<artifactId>recaf</artifactId>
<url>https://github.com/Col-E/Recaf/</url>
<version>2.13.0</version>
<version>2.13.1</version>
<name>Recaf</name>
<description>A modern java bytecode editor</description>
<!-- Variables -->
Expand Down
17 changes: 14 additions & 3 deletions src/main/java/me/coley/recaf/Recaf.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import me.coley.recaf.plugin.api.EntryLoaderProviderPlugin;
import me.coley.recaf.util.Log;
import me.coley.recaf.util.Natives;
import me.coley.recaf.util.OSUtil;
import me.coley.recaf.util.VMUtil;
import me.coley.recaf.util.self.SelfDependencyPatcher;
import me.coley.recaf.util.self.SelfUpdater;
Expand All @@ -29,7 +30,7 @@
* @author Matt
*/
public class Recaf {
public static final String VERSION = "2.13.0";
public static final String VERSION = "2.13.1";
public static final String DOC_URL = "https://col-e.github.io/Recaf/documentation.html";
public static final int ASM_VERSION = Opcodes.ASM9;
private static Controller currentController;
Expand Down Expand Up @@ -172,8 +173,18 @@ public static boolean isHeadless() {
public static Path getDirectory() {
Path configDir = Recaf.configDir;
if (configDir == null) {
configDir = Recaf.configDir = Paths.get(BaseDirectories.get().configDir)
.resolve("Recaf");
try {
configDir = Recaf.configDir = Paths.get(BaseDirectories.get().configDir)
.resolve("Recaf");
} catch (Throwable t) {
// BaseDirectories library has a powershell problem...
// This should only affect windows
if (OSUtil.getOSType() == OSUtil.WINDOWS) {
configDir = Paths.get(System.getenv("APPDATA"), "Recaf");
} else {
throw new IllegalStateException("Failed to initialize Recaf directory");
}
}
}
return configDir;
}
Expand Down

0 comments on commit 96dfcf1

Please sign in to comment.