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

Method findDataFolder

code/src/test/pcgen/util/TestHelper.java:473–493  ·  view source on GitHub ↗

Locate the data folder which contains the primary set of LST data. This defaults to the data folder under the current directory but can be customized in the config.ini folder. @return The path of the data folder.

()

Source from the content-addressed store, hash-verified

471 * @return The path of the data folder.
472 */
473 public static String findDataFolder()
474 {
475 // Set the pcc location to "data"
476 String pccLoc = "data";
477
478 // Read in config.ini and override the pcc location if it exists
479 try (var lines = Files.lines(Path.of("config.ini")))
480 {
481 var pccFilesPath = lines
482 .filter(line -> line.startsWith("pccFilesPath="))
483 .map(line -> line.substring(13))
484 .findFirst()
485 .orElse(pccLoc);
486
487 return pccFilesPath;
488 } catch (IOException e)
489 {
490 // Ignore, see method comment
491 }
492 return pccLoc;
493 }
494
495 /**
496 * Write a settings/config file for use by unit tests.

Callers 4

runTestMethod · 0.95
loadGameModesMethod · 0.95
loadGameModesMethod · 0.95
loadGameModesMethod · 0.95

Calls 2

ofMethod · 0.80
orElseMethod · 0.65

Tested by

no test coverage detected