Skip to content

Commit

Permalink
#24 Use javafx.platform instead of os.name (#34)
Browse files Browse the repository at this point in the history
* #24 Use javafx.platform instead of os.name

* Don’t use os.target
  • Loading branch information
José Pereda authored Jan 16, 2020
1 parent d03d671 commit 4d427fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions modules/util/src/main/java/com/gluonhq/attach/util/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ public enum Platform {
private static final Logger LOGGER = Logger.getLogger(Platform.class.getName());

static {
String os = System.getProperty("os.name", DESKTOP.getName()).toLowerCase(Locale.ROOT);
if (os.contains("mac") || os.contains("win") || os.contains("nux")) {
os = DESKTOP.getName();
String platform = System.getProperty("javafx.platform", null);
if (platform == null) {
LOGGER.info("javafx.platform is not defined. Desktop will be assumed by default.");
platform = DESKTOP.getName();
}
String name = os.toUpperCase(Locale.ROOT);

String name = platform.toUpperCase(Locale.ROOT);
current = valueOf(name);
LOGGER.fine("Current platform: " + current);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private T createInstance(Platform platform) {
LOGGER.log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
// no-op
LOGGER.log(Level.WARNING, "No new instance for " + serviceType);
LOGGER.log(Level.WARNING, "No new instance for " + serviceType + " and class " + fqn);
}
return null;
}
Expand Down

0 comments on commit 4d427fa

Please sign in to comment.