-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for the XDG base directory specification #336
base: master
Are you sure you want to change the base?
Conversation
Hello @mcz , If you still out there and willing to resolve the merge conflicts with this PR, it could be merge. Thanks, |
Might take me some time because the original code was kinda half-assed, and I'd like to do it correctly this time. com_homedir is used for many things, while I also noticed some places using
I can't imagine this being the intentional behaviour, but since I can't find anything documenting how that command line argument is supposed to work, I can't be sure. I think that those should be changed to one of 3 things:
Finally,
So just blindly using Would be great if you could comment on the ideas I've described (especially when it comes to the |
Hi @mcz , Thanks for the detailed reply! The truth of the matter is that we just recently got the ownership of this repo. None of the main developers are active at this moment, so we don't really have a serious direction. Our main goal currently is just to make the contributions get going on again, and to solve serious bugs. What do you think? |
I have a more or less good idea of what the directory structure should look like when it comes to GNU/Linux (and other platform inplementing the freedesktiop.org standards). I have basically no idea how things should look like on other platform (WIndows, MacOS, ...) and if there are legacy aspects we should respect. For that I think it would be great to have some input from someone who is familliar with the history of (ez)quake. It's hard to know if the current behaviour is intentional when there is no documentation and the relevant commit message (1562985) doesn't even mention it.
Definitely. It will probably take a week or so. |
Is the directory layout handling not already separated between windows and linux? Are these not handled in sys_posix.c and sys_win.c source files? I think it will be impossible to extract the "idea" behind the original authors about directory layout. What can be done is to check how is it done currently in a windows environment. But for detailed and correct information I think we should dive deep into the directory handling of windows, including elevated rights/access, virtual store (if that is still a thing on Win10/11) and all that stuff. Combined with the (legacy?) concept of a QuakeWorld client's file- and directory dependencies. |
The way they are separated is by having different methods of getting
I'll have to add some separation in getting the config dir, but it shouldn't be too hard. |
5175b9d
to
c0a3e02
Compare
Fall back on $HOME/.local/share, if necessary. Return "\0" on fail, just like the WIndows version. Use system("mkdir -p") to crate the directory structure in Sys_RegisterQWURLProtocol_f()
Fixes a bug where having an executable called for example '/path/to/quake/weird\name' (with a backslash in the filename) would lead to FS_InitFilesystemEx(true) using '/path/to/quake/test' as com_basedir instead of '/path/to/quake'.
AddUserDirectory should still use $HOME. Also change the windows Sys_HomeDirectory to return a pointer to a malloc-ed string that has to be freed so that it watches the posix version.
3faf681
to
0c606e8
Compare
Fallback to com_gamedir. Also detriplicate code for finding the path of the config file. Change Signature for Sys_HomeDirectory since it's no longer const. Fix some mistakes from previous commits.
0c606e8
to
097b140
Compare
"Fix" for functions using com_homedir not checking whether it actually contains a path, leading to paths that should be relative to com_homedir actually being absolute. Also remove the now unnecessary checks that did exist in some functions.
The branch is currently in a state where it accomplishes what I set out to do. That's why I propose to do a bit of an overhaul of the whole file handling system, including the following points:
What I still need to figure out is if and how to still leave the option for the current one-directory setup. |
this is what debian accomplishes by using -basedir, though it is quite annoying as classically we do just throw a binary into a quake directory and you're done, or symlink it. it could test pwd first and it would accomplish both things. |
-basedir
annoying, as you said. Requires a wrapper script
throw a binary into a quake directory
that quake directory is probably /usr/share/ezquake (or /usr/share/games/ezquake on Debian), which is bad, since /usr/share is meant for architecture-independent data
test pwd
still requires a wrapper script to change to the data directory
And afaik, neither of those solutions allow for the .pak files to be outside of /usr, which would be nice since leaving writing to there should best be left to the package manager.
|
you can just put everything in ~/.config/ezquake, or you can put media in /usr/games/quake and use cfg_use_home to save things to ~/.ezquake. that said, i personally have no problem with updating to use xdg directories for things so long as you can absolutely still just use a normal quake directory for everything. |
@mcz , Could we summarize what does this PR actually contain at this moment? Do we need to create a small how-to for the linux users who are willing to test these changes? |
I wouldn't release this to testers quite yet, since there are still things I would like to fix. One big thing I noticed is that when working with paths, while functions like strlcat are used to avoid buffer overflows, there are no checks to see if all the data was actually written to *dest. So in the case of very long paths, it is possible that there might be writes to unexpected locations. And the other thing I would like to add (though that should probably be a separate PR) is differenciating between the directories with the executable and the one with the data (and possibly a third with configs, so systemwide configs can go to /etc). While the xdg base dir thing is for users, this other change would be mainly for packagers. |
Hi @mcz, Give me a status update, please ;) |
I'm sorry. I've been really busy in real life, so I didn't have much time to work on this. Technically the current status of the PR has user-level file management in a good state, while all the system-level stuff should probably be separate. |
HI @mcz , No worries, no need to apologize ;). |
I've become somewhat interested in this feature. I come from the classic "throw it all in a directory" days, but with the recent maturity of the ezQuake.AppImage builds, I have a grown interest in being able to drop that in @mcz Unfortunately, it's not always that clear. There is the messy middle, such as different custom assets in the form of I think a potentially interesting approach to that last bucket would be to allow |
If you try the latest snapshot of the appimage it should just use wherever you threw it as a quake directory if where you run it from doesn't contain id1, so it pretty much accomplishes the goal. As far as I'm concerned it's still always a bit convoluted/complex to distribute junk around home directory junk instead of just always using a single portable directory for everything, you always end up with some sort of search/save priority and cvars you have to tweak etc etc, making it support both for various things is just a pain and I don't think anybody wants to get rid of just being able to have a quake directory. |
I'm not finding that to be the experience.
Latest AppImage in ~
id1 folder within ~/.ezquake
```
~
❯ ./ezQuake-x86_64.AppImage
executing with native libc
Error: Couldn't load gfx/palette.lmp
This is typically caused by being unable to locate pak0.pak.
Copy pak0.pak into 'id1' folder, in same directory as executable.
~
❯ tree .ezquake
.ezquake
├── id1
│ ├── pak0.pak
│ └── pak1.pak
└── temp
3 directories, 2 files```
…On Thu, Nov 23, 2023 at 9:37 AM dustin ***@***.***> wrote:
If you try the latest snapshot of the appimage it should just use wherever
you threw it as a quake directory if where you run it from doesn't contain
id1, so it pretty much accomplishes the goal. As far as I'm concerned it's
still always a bit convoluted/complex to distribute junk around home
directory junk instead of just always using a single portable directory for
everything, you always end up with some sort of search/save priority and
cvars you have to tweak etc etc, making it support both for various things
is just a pain and I don't think anybody wants to get rid of just being
able to have a quake directory.
—
Reply to this email directly, view it on GitHub
<#336 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF5JTDHAVQLKJ5NJYRFQWTYF6CVDAVCNFSM4IVJ2KJ2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGQ3TMNRVHE3Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
(edit: i see you were running it from home, that's not what i meant, it uses the directory the appimage exists in as the basedir as a fallback to cwd)
fyi you've always been able to do this if you really wanted, debian's version does something similar by wrapping it in a shell script and just setting basedir and/or symlinking stuff from /usr/share|/usr/games into homedir stuff. again i find all of this a bit ridiculous though, spreading out configs/media/resources amongst multiple homedir directories just over complicates things, especially for something like quake in which we do actually manually edit configs/resources unlike newer stuff where that's the exception and most things are done through menus etc. there will always be times where you set something in a config (or even media) and because that thing is now set in some other directory and is part of the search path, it'll get pulled in even if you're not expecting it to (say you've changed cfg_use_home) because on startup it doesn't know what that's set to yet, and if you've changed it to 0, you're still parsing your home dir config on startup, which may set it back to 1 etc etc. |
Uses
"$XDG_CONFIG_DIR"/ezquake
instead of"$HOME"/.ezquake
if$XDG_CONFIG_DIR
is set.