MCPcopy Create free account
hub / github.com/PCGen/pcgen / loadProperties

Method loadProperties

code/src/java/pcgen/system/Main.java:257–294  ·  view source on GitHub ↗
(boolean useGui)

Source from the content-addressed store, hash-verified

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.

Callers 6

loadGameModesMethod · 0.95
loadGameModesMethod · 0.95
loadGameModesMethod · 0.95
mainMethod · 0.95
startupWithGUIMethod · 0.95
startupWithoutGUIMethod · 0.95

Calls 15

getSystemPropertyMethod · 0.95
errorPrintMethod · 0.95
exitMethod · 0.95
showAndBlockMethod · 0.95
setDefaultFactoryMethod · 0.95
getDefaultFactoryMethod · 0.95
getInstanceMethod · 0.95
getInstanceMethod · 0.95
getInstanceMethod · 0.95
loadPropertyContextsMethod · 0.95
getPropertyMethod · 0.95

Tested by 3

loadGameModesMethod · 0.76
loadGameModesMethod · 0.76
loadGameModesMethod · 0.76