| 255 | } |
| 256 | |
| 257 | public static void loadProperties(boolean useGui) |
| 258 | { |
| 259 | if (commandLineArguments.getSettingsDir().isEmpty() |
| 260 | && (ConfigurationSettings.getSystemProperty(ConfigurationSettings.SETTINGS_FILES_PATH) == null)) |
| 261 | { |
| 262 | if (!useGui) |
| 263 | { |
| 264 | Logging.errorPrint("No settingsDir specified via -s in batch mode and no default exists."); |
| 265 | GracefulExit.exit(1); |
| 266 | } |
| 267 | var panel = new JFXPanelFromResource<>( |
| 268 | OptionsPathDialogController.class, |
| 269 | "OptionsPathDialog.fxml" |
| 270 | ); |
| 271 | panel.showAndBlock("Directory for options.ini location"); |
| 272 | } |
| 273 | PropertyContextFactory.setDefaultFactory(commandLineArguments.getSettingsDir().map(File::getPath).orElse(null)); |
| 274 | |
| 275 | //Existing PropertyContexts are registered here |
| 276 | PropertyContextFactory defaultFactory = PropertyContextFactory.getDefaultFactory(); |
| 277 | PropertyContext settingscontext = PCGenSettings.getInstance(); |
| 278 | defaultFactory.registerPropertyContext(settingscontext); |
| 279 | defaultFactory.registerPropertyContext(UIPropertyContext.getInstance()); |
| 280 | defaultFactory.registerPropertyContext(LegacySettings.getInstance()); |
| 281 | defaultFactory.loadPropertyContexts(); |
| 282 | //Make savepath directory if it doesn't exist |
| 283 | String savepath = settingscontext.getProperty(PCGenSettings.PCG_SAVE_PATH); |
| 284 | File savepath_dir = new File(savepath); |
| 285 | if (!savepath_dir.exists() && !savepath_dir.isDirectory()) |
| 286 | { |
| 287 | Logging.log(Level.INFO, "Making directory " + savepath_dir); |
| 288 | boolean succeeded = savepath_dir.mkdir(); |
| 289 | if (!succeeded) |
| 290 | { |
| 291 | Logging.log(Level.SEVERE, "Unable to create PCG_SAVE_PATH " + savepath_dir); |
| 292 | } |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Create a task to load all system plugins. |