+ private static Path getLocalPath(String systemProperty, String environmentVariable, Path defaultPath) {
+ String prop = System.getProperty(systemProperty);
+ if (prop != null)
+ return Paths.get(prop);
+ String env = System.getenv().get(environmentVariable);
+ if (env != null)
+ return Paths.get(env);
+ if (defaultPath != null)
+ return defaultPath;
+ throw new IllegalStateException("No local path set with system property " + systemProperty
+ + " or environment variable " + environmentVariable);
+ // TODO allocate a temporary directory? or defaults based on working directory ?
+ }