PCGen / pcgen

Main code and data development for pcgen program release
http://pcgen.org
GNU Lesser General Public License v2.1
432 stars 339 forks source link

Let source loading follow symlinks #6832

Closed larsnaesbye closed 1 year ago

larsnaesbye commented 1 year ago

Is your feature request related to a problem? Please describe. That depends. I was trying to have my custom data in a git repo, and have symlinks to them in the gameSystem and data folders. They do not load.

Describe the solution you'd like Filesystem resolution of symlinks when loading data upon startup of PCGen.

Describe alternatives you've considered Copying edited files back and forth, replacing with every edit.

larsnaesbye commented 1 year ago

I even think I know why. PCGen uses the legacy java.io.File package, and it has no support for symbolic links.

Would there be any objections to rewriting file access to use, say, java.nio.file.Files instead - other than of course time and resources?

Vest commented 1 year ago

@larsnaesbye your feature sounds interesting. Maybe I will try to implement it just for fun :) Can you please tell me the scenario, when you might need symbolic links? There are not so many places in code, where java.io.File is used, so I don't want to blindly replace all of these calls with java.nio.

p.s. I don't know, if the JIRA issue is required for this feature, but let other members comment this thread, if they have some thoughts.

larsnaesbye commented 1 year ago

I would only do it in the case of system and data folders, so you could have symlinks to folders you're working on.

I have a pull request in the making, but so far I've only thoroughly tested that it doesn't make things worse (ie. it loads all non-symlinked folders fine).

larsnaesbye commented 1 year ago

Silly me. If only I had made my symlinks right. Turns out PCgen does in fact follow UNIX-style symlinks (but not macOS aliases or Windows shortcuts).

The pull request does not change the behaviour for better or worse, so I'll just retract it.