Merge pull request #2067 from iBotPeaches/issue-2048

fix: create directory if doesn't exist, before error
This commit is contained in:
Connor Tumbleson 2019-04-24 19:55:38 -04:00 committed by GitHub
commit 422f964041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -924,17 +924,6 @@ final public class AndrolibResources {
} else {
path = parentPath.getAbsolutePath() + String.format("%1$s.local%1$sshare%1$sapktool%1$sframework", File.separatorChar);
}
File fullPath = new File(path);
if (! fullPath.canWrite()) {
LOGGER.severe(String.format("WARNING: Could not write to (%1$s), using %2$s instead...",
fullPath.getAbsolutePath(), System.getProperty("java.io.tmpdir")));
LOGGER.severe("Please be aware this is a volatile directory and frameworks could go missing, " +
"please utilize --frame-path if the default storage directory is unavailable");
path = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath();
}
}
File dir = new File(path);
@ -956,6 +945,17 @@ final public class AndrolibResources {
}
}
if (apkOptions.frameworkFolderLocation == null) {
if (! dir.canWrite()) {
LOGGER.severe(String.format("WARNING: Could not write to (%1$s), using %2$s instead...",
dir.getAbsolutePath(), System.getProperty("java.io.tmpdir")));
LOGGER.severe("Please be aware this is a volatile directory and frameworks could go missing, " +
"please utilize --frame-path if the default storage directory is unavailable");
dir = new File(System.getProperty("java.io.tmpdir"));
}
}
mFrameworkDirectory = dir;
return dir;
}