Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Edvin Syse committed Jul 16, 2018
2 parents 4a03be8 + d5f3d4a commit eae29cd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/main/java/fxlauncher/FXManifest.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ public Path resolveCacheDir(Map<String, String> namedParams) {
.toString();
}
path = Paths.get(replacement);
} else if (cacheDir.startsWith("ALLUSERS")) {
switch (OS.current) {
case mac:
path = Paths.get("/Library/Application Support")
.resolve(cacheDir.substring(9));
break;
case win:
path = Paths.get(System.getenv("ALLUSERSPROFILE"))
.resolve(cacheDir.substring(9));
break;
default:
path = Paths.get("/usr/local/share")
.resolve(cacheDir.substring(9));
}
} else {
path = Paths.get(cacheDir);
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/fxlauncher/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void createApplication(Class<Application> appClass) {
PlatformImpl.runAndWait(() ->
{
try {
if (appClass.isAssignableFrom(Application.class)){
if (Application.class.isAssignableFrom(appClass)) {
app = appClass.newInstance();
}
} catch (Throwable t) {
Expand Down Expand Up @@ -91,7 +91,7 @@ protected void setupClassLoader(ClassLoader classLoader) {

/**
* Check if a new version is available and return the manifest for the new version or null if no update.
*
* <p>
* Note that updates will only be detected if the application was actually launched with FXLauncher.
*
* @return The manifest for the new version if available
Expand Down Expand Up @@ -142,7 +142,7 @@ public void start(Stage primaryStage) throws Exception {
filesUpdated[0] = superLauncher.syncFiles();
} catch (Exception ex) {
log.log(Level.WARNING, String.format("Error during %s phase", superLauncher.getPhase()), ex);
if(superLauncher.checkIgnoreUpdateErrorSetting()) {
if (superLauncher.checkIgnoreUpdateErrorSetting()) {
superLauncher.reportError(String.format("Error during %s phase", superLauncher.getPhase()), ex);
System.exit(1);
}
Expand Down Expand Up @@ -223,13 +223,13 @@ public void stop() throws Exception {
}

private void initApplication() throws Exception {
if (app != null){
if (app != null) {
app.init();
}
}

private void startApplication() throws Exception {
if (app != null){
if (app != null) {
ParametersImpl.registerParameters(app, new LauncherParams(getParameters(), superLauncher.getManifest()));
PlatformImpl.setApplicationName(app.getClass());
superLauncher.setPhase("Application Init");
Expand All @@ -239,7 +239,7 @@ private void startApplication() throws Exception {
List<LibraryFile> files = superLauncher.getManifest().files;
String cacheDir = superLauncher.getManifest().cacheDir;
String command = String.format("java -jar %s/%s", cacheDir, files.get(0).file);
log.info(String.format("Execute command '%s'",command));
log.info(String.format("Execute command '%s'", command));
Runtime.getRuntime().exec(command);
}
}
Expand Down

0 comments on commit eae29cd

Please sign in to comment.