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

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