ThibautSF / ParadoxosModManagerRework

Software to manage mods for recent Paradox games, work in progress, Java 11
MIT License
64 stars 7 forks source link

DocPath does not allow network directory locations #40

Closed GensIotaDev closed 4 years ago

GensIotaDev commented 4 years ago

I'm getting the "Document path is not correct" error on trying to use a directory on an NAS (I have the Windows Documents redirected from the C drive to \\SERVER\Redirected\Documents).

Looking into it; the issue could be either the file separator regex at line 377 (ModManager.java), where to get a network file to work, the path requires '\\\\', except the replaceAll function is used on it. The new File(path) at line 403 (ModManager.java) may also fail without converting the network path to a URI (though I am not 100% sure on whether the four backslashes circumvents this required change)

ThibautSF commented 4 years ago

Since I don't have the possibility to test, if you could test the linked build

This build : https://drive.google.com/file/d/1u7StGfyjLhDGsqIYpdFYEzTPS3Ef3Sa8/view?usp=sharing

Change line

docPathStr = docPathStr.replaceAll("(\\\\+|/+)", Matcher.quoteReplacement(File.separator));

to

Path path = Paths.get(docPathStr);
path = Paths.get("/").resolve(path.normalize()).normalize();
docPathStr = path.toString();
System.out.println(docPathStr);

(yes, I leave a print of the string in the console in case it could be useful)

GensIotaDev commented 4 years ago

Change worked. Everything seems to be recognized. Thanks!