DescentDevelopers / Descent3

Descent 3 by Outrage Entertainment
GNU General Public License v3.0
2.73k stars 231 forks source link

Add `-additionaldir` command-line option #471

Open Jayman2000 opened 1 week ago

Jayman2000 commented 1 week ago

Pull Request Type

Description

This PR adds a command-line argument named -additionaldir. -additionaldir allows users to store game assets in multiple different directories. For example, if a user installs Descent 3 using a package manager, then they’ll be able to do this:

Descent3 -setdir <path-to-proprietary-assets> -additionaldir <path-to-assets-installed-by-package-manager>

Related Issues

This is related to #373, but it doesn’t implement it.

Checklist

Additional Comments

This PR is meant to be a first step. If it gets accpeted, then I’ll open PRs to do the following:

winterheart commented 1 week ago

Hi. I'm working on cfile / ddio refactoring and some of your changes already done in my branch. I'd suggest to wait it since after that path handling and general filesystem operations will be much simpler.

Still, there some comments on general idea (as I see it, regarding to #373 and similar issues). We have read-only and writable paths. Read-only are some preconfigured on build-time paths (like /usr/share/Descent3 in Linux or values from Registry in Windows from preinstalled D3) and defined by configuration/command line options. Writable paths are paths that known to belong to current user (like $HOME/.config, $HOME/.local in Linux, and C:\users\USER\AppData in Windows). All of these paths together forms search path list, that should be searched from writable to read-only. Descent3 should use relative path notation for resource lookup, and cfile / ddio will handle all work to search and open requested file. There no current dir in search for reason. Unless we going to make "portable" mode for game, Descent3 should use proposed scheme to write user-data (cache/temp files included) to writeable paths that belongs to user. Current dir may not belong to user, so we should avoid overuse it.

Jayman2000 commented 1 week ago

Hi. I'm working on cfile / ddio refactoring and some of your changes already done in my branch. I'd suggest to wait it since after that path handling and general filesystem operations will be much simpler.

So you’re saying that I should rebase this PR on main once your PR gets merged?

Still, there some comments on general idea (as I see it, regarding to #373 and similar issues). We have read-only and writable paths. Read-only are some preconfigured on build-time paths (like /usr/share/Descent3 in Linux or values from Registry in Windows from preinstalled D3) and defined by configuration/command line options. Writable paths are paths that known to belong to current user (like $HOME/.config, $HOME/.local in Linux, and C:\users\USER\AppData in Windows). All of these paths together forms search path list, that should be searched from writable to read-only. Descent3 should use relative path notation for resource lookup, and cfile / ddio will handle all work to search and open requested file. There no current dir in search for reason. Unless we going to make "portable" mode for game, Descent3 should use proposed scheme to write user-data (cache/temp files included) to writeable paths that belongs to user. Current dir may not belong to user, so we should avoid overuse it.

I agree. This PR implements all of what you said, except for these things: