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

Method validateEnvironment

code/src/java/pcgen/system/Main.java:219–255  ·  view source on GitHub ↗

Check that the runtime environment is suitable for PCGen to run.

(boolean useGui)

Source from the content-addressed store, hash-verified

217 * Check that the runtime environment is suitable for PCGen to run.
218 */
219 private static void validateEnvironment(boolean useGui)
220 {
221 // Check our main folders are present
222 String[] neededDirs = {
223 ConfigurationSettings.getSystemsDir(), ConfigurationSettings.getPccFilesDir(),
224 ConfigurationSettings.getPluginsDir(), ConfigurationSettings.getPreviewDir(),
225 ConfigurationSettings.getOutputSheetsDir()
226 };
227 String missingDirs = Arrays.stream(neededDirs)
228 .map(File::new)
229 .filter(Predicate.not(File::exists))
230 .map(dir -> {
231 try
232 {
233 return dir.getCanonicalPath();
234 }
235 catch (IOException e)
236 {
237 Logging.errorPrint("Unable to find canonical path for " + dir);
238 return dir.getPath();
239 }
240 })
241 .map(path -> " " + path)
242 .collect(Collectors.joining("\n"));
243
244 if (!missingDirs.isEmpty())
245 {
246 String message = "This installation of PCGen is missing the following required folders:\n" + missingDirs;
247 Logging.errorPrint(message);
248 if (useGui)
249 {
250 JOptionPane.showMessageDialog(null, message + "\nPlease reinstall PCGen.", Constants.APPLICATION_NAME,
251 JOptionPane.ERROR_MESSAGE);
252 }
253 GracefulExit.exit(1);
254 }
255 }
256
257 public static void loadProperties(boolean useGui)
258 {

Callers 2

startupWithGUIMethod · 0.95
startupWithoutGUIMethod · 0.95

Calls 12

getSystemsDirMethod · 0.95
getPccFilesDirMethod · 0.95
getPluginsDirMethod · 0.95
getPreviewDirMethod · 0.95
getOutputSheetsDirMethod · 0.95
errorPrintMethod · 0.95
exitMethod · 0.95
streamMethod · 0.80
getPathMethod · 0.80
joiningMethod · 0.80
isEmptyMethod · 0.65
showMessageDialogMethod · 0.45

Tested by

no test coverage detected