refactor(PathManager): factor out defaultModPaths
@@ -308,15 +308,7 @@ private void updateDirs() throws IOException {
}
sandboxPath = homePath.resolve(SANDBOX_DIR);
- Path homeModPath = homePath.resolve(MODULE_DIR);
- Path modCachePath = homePath.resolve(MODULE_CACHE_DIR);
-
- if (Files.isSameFile(homePath, installPath)) {
- modPaths = ImmutableList.of(modCachePath, homeModPath);
- } else {
- Path installModPath = installPath.resolve(MODULE_DIR);
- modPaths = ImmutableList.of(installModPath, modCachePath, homeModPath);
- }
+ modPaths = defaultModPaths();
for (Path path : getAllPaths()) {
Files.createDirectories(path);
@@ -345,6 +337,18 @@ private void updateDirs() throws IOException {
}
+ protected ImmutableList<Path> defaultModPaths() throws IOException {
+ Path homeModPath = homePath.resolve(MODULE_DIR);
+ Path modCachePath = homePath.resolve(MODULE_CACHE_DIR);
+
+ if (Files.isSameFile(homePath, installPath)) {
+ return ImmutableList.of(modCachePath, homeModPath);
+ } else {
+ Path installModPath = installPath.resolve(MODULE_DIR);
+ return ImmutableList.of(installModPath, modCachePath, homeModPath);
+ }
+ }
+
public Path getHomeModPath() {
return modPaths.get(0);
}
