Auto-create app dir if we have an appbase.
We were already doing this for bootstrap.properties-based launches, but there's no reason to restrict it to that. If you run Getdown with an appbase and an appdir, it can create the app dir and download the app into it. This enables scenarios where getdown is installed to a shared location and users that run the app install it in their private storage area (or on a machine local file system, or who knows). Closes #163.
This commit is contained in:
@@ -2,9 +2,14 @@
|
||||
|
||||
## 1.8.1 - Unreleased
|
||||
|
||||
* If both an `appbase` and `appdir` are provided via some means (bootstrap properties file, system
|
||||
property, etc.) and the app dir does not yet exist, Getdown will create it.
|
||||
|
||||
* Added `max_concurrent_downloads` setting to `getdown.txt`. Controls what you would expect.
|
||||
Defaults to two.
|
||||
|
||||
* Fixed issue with `appid` not being properly used when specified via command line arg.
|
||||
|
||||
* Fixed issue with running Getdown on single CPU systems (or virtual systems). It was attempting to
|
||||
create a thread pool of size zero, which failed.
|
||||
|
||||
|
||||
@@ -60,10 +60,6 @@ public final class EnvConfig {
|
||||
if (bundle.containsKey("appdir")) {
|
||||
appDir = bundle.getString("appdir");
|
||||
appDir = appDir.replace(USER_HOME_KEY, System.getProperty("user.home"));
|
||||
File appDirFile = new File(appDir);
|
||||
if (!appDirFile.exists()) {
|
||||
appDirFile.mkdirs();
|
||||
}
|
||||
appDirProv = "bootstrap.properties";
|
||||
}
|
||||
if (bundle.containsKey("appid")) {
|
||||
@@ -137,17 +133,32 @@ public final class EnvConfig {
|
||||
return null; // caller will report problem to user
|
||||
}
|
||||
|
||||
// ensure that the appdir refers to a directory that exists
|
||||
File appDirFile = new File(appDir);
|
||||
if (!appDirFile.exists() || !appDirFile.isDirectory()) {
|
||||
notes.add(Note.error("Invalid appdir '" + appDir + "'."));
|
||||
return null;
|
||||
}
|
||||
|
||||
notes.add(Note.info("Using appdir from " + appDirProv + ": " + appDir));
|
||||
if (appId != null) notes.add(Note.info("Using appid from " + appIdProv + ": " + appId));
|
||||
if (appBase != null) notes.add(Note.info("Using appbase from " + appBaseProv + ": " +
|
||||
appBase));
|
||||
if (appBase != null) notes.add(
|
||||
Note.info("Using appbase from " + appBaseProv + ": " + appBase));
|
||||
|
||||
// ensure that the appdir refers to a directory that exists
|
||||
File appDirFile = new File(appDir);
|
||||
if (!appDirFile.exists()) {
|
||||
// if we have a bootstrap URL then we auto-create the app dir; this enables an
|
||||
// installer to simply place a getdown.jar file somewhere and create an OS shortcut
|
||||
// that runs getdown with an appdir and appbase specified, and have getdown create the
|
||||
// appdir and download the app into it
|
||||
if (!StringUtil.isBlank(appBase)) {
|
||||
if (appDirFile.mkdirs()) {
|
||||
notes.add(Note.info("Auto-created app directory '" + appDir + "'"));
|
||||
} else {
|
||||
notes.add(Note.warn("Unable to auto-create app dir: '" + appDir + "'"));
|
||||
}
|
||||
} else {
|
||||
notes.add(Note.error("Invalid appdir '" + appDir + "': directory does not exist"));
|
||||
return null;
|
||||
}
|
||||
} else if (!appDirFile.isDirectory()) {
|
||||
notes.add(Note.error("Invalid appdir '" + appDir + "': refers to non-directory"));
|
||||
return null;
|
||||
}
|
||||
|
||||
// pass along anything after the first two args as extra app args
|
||||
List<String> appArgs = argv.length > 2 ?
|
||||
|
||||
Reference in New Issue
Block a user