parent
e383e6596f
commit
47bbf9d97e
@ -181,6 +181,7 @@ class SceneBuilderDialog extends ModalDialog {
|
|||||||
browseBtn.setMinWidth(120);
|
browseBtn.setMinWidth(120);
|
||||||
browseBtn.setOnAction(e -> {
|
browseBtn.setOnAction(e -> {
|
||||||
var dirChooser = new DirectoryChooser();
|
var dirChooser = new DirectoryChooser();
|
||||||
|
dirChooser.setInitialDirectory(SceneBuilderInstaller.getDefaultConfigDir().toFile());
|
||||||
File dir = dirChooser.showDialog(getScene().getWindow());
|
File dir = dirChooser.showDialog(getScene().getWindow());
|
||||||
if (dir != null) {
|
if (dir != null) {
|
||||||
model.setInstallDir(dir.toPath());
|
model.setInstallDir(dir.toPath());
|
||||||
|
@ -28,6 +28,7 @@ final class SceneBuilderInstaller {
|
|||||||
|
|
||||||
private static final String CONFIG_FILE_NAME = "SceneBuilder.cfg";
|
private static final String CONFIG_FILE_NAME = "SceneBuilder.cfg";
|
||||||
private static final String THEME_PACK_FILE_NAME = "atlantafx-scene-builder.zip";
|
private static final String THEME_PACK_FILE_NAME = "atlantafx-scene-builder.zip";
|
||||||
|
private static final char CLASSPATH_SEPARATOR = PlatformUtils.isWindows() ? ';' : ':';
|
||||||
|
|
||||||
private final Path sceneBuilderDir;
|
private final Path sceneBuilderDir;
|
||||||
private Path configDir;
|
private Path configDir;
|
||||||
@ -169,7 +170,7 @@ final class SceneBuilderInstaller {
|
|||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
var line = it.next();
|
var line = it.next();
|
||||||
if (line != null && line.startsWith("app.classpath")) {
|
if (line != null && line.startsWith("app.classpath")) {
|
||||||
it.set(line.replace("$APPDIR" + File.separator + THEME_PACK_FILE_NAME + ":", ""));
|
it.set(line.replace("$APPDIR" + File.separator + THEME_PACK_FILE_NAME + CLASSPATH_SEPARATOR, ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +222,18 @@ final class SceneBuilderInstaller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Path getDefaultConfigDir() {
|
||||||
|
if (PlatformUtils.isWindows()) {
|
||||||
|
return Path.of(System.getProperty("user.home"), "AppData", "Local", "SceneBuilder");
|
||||||
|
} else if (PlatformUtils.isLinux()) {
|
||||||
|
return Path.of("/opt/scenebuilder/");
|
||||||
|
} else if (PlatformUtils.isUnix()) {
|
||||||
|
return Path.of("/Applications/SceneBuilder.app/");
|
||||||
|
} else {
|
||||||
|
return Path.of(".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Path getConfigDir() {
|
private Path getConfigDir() {
|
||||||
if (configDir != null) {
|
if (configDir != null) {
|
||||||
return configDir;
|
return configDir;
|
||||||
|
Loading…
Reference in New Issue
Block a user