make default framework detection on linux xdg-compliant (#2924)

On Linux, check first if $XDG_DATA_HOME is set, if not use path as it was before (~/.local/share/apktool)
This commit is contained in:
Miepee 2022-11-08 11:54:36 +01:00 committed by GitHub
parent f8df056a2c
commit 6a70be6c26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -973,10 +973,15 @@ final public class AndrolibResources {
path = parentPath.getAbsolutePath() + String.format("%1$sLibrary%1$sapktool%1$sframework", File.separatorChar); path = parentPath.getAbsolutePath() + String.format("%1$sLibrary%1$sapktool%1$sframework", File.separatorChar);
} else if (OSDetection.isWindows()) { } else if (OSDetection.isWindows()) {
path = parentPath.getAbsolutePath() + String.format("%1$sAppData%1$sLocal%1$sapktool%1$sframework", File.separatorChar); path = parentPath.getAbsolutePath() + String.format("%1$sAppData%1$sLocal%1$sapktool%1$sframework", File.separatorChar);
} else {
String xdgDataFolder = System.getenv("XDG_DATA_HOME");
if (xdgDataFolder != null) {
path = xdgDataFolder + String.format("%1$sapktool%1$sframework", File.separatorChar);
} else { } else {
path = parentPath.getAbsolutePath() + String.format("%1$s.local%1$sshare%1$sapktool%1$sframework", File.separatorChar); path = parentPath.getAbsolutePath() + String.format("%1$s.local%1$sshare%1$sapktool%1$sframework", File.separatorChar);
} }
} }
}
File dir = new File(path); File dir = new File(path);