Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Move default data directory to XDG_DATA_HOME on Linux #470

Merged
merged 6 commits into from
Feb 14, 2022

Conversation

facespkz
Copy link
Contributor

This takes the current default into account, so it would only be noticeable on a fresh install.

Also a minor refactor for generating the old path.

prboom2/src/SDL/i_system.c Outdated Show resolved Hide resolved
prboom2/src/SDL/i_system.c Outdated Show resolved Hide resolved
prboom2/src/SDL/i_system.c Show resolved Hide resolved
prboom2/src/SDL/i_system.c Outdated Show resolved Hide resolved
@fabiangreffrath fabiangreffrath merged commit 11562ba into coelckers:master Feb 14, 2022
@fabiangreffrath
Copy link
Collaborator

Thank you!

@facespkz
Copy link
Contributor Author

Heads up, I think I found a race condition. I don't know how or why it happens, but by all accounts it looks like it shouldn't.

@fabiangreffrath
Copy link
Collaborator

What exactly do you mean?

@facespkz
Copy link
Contributor Author

facespkz commented Feb 14, 2022

For some reason, maybe 5-10% of the time, the code will return the old path, regardless of if it exists or not. Maybe a bug with the filesystem I'm on, but I just thought it would wait for the stat() to finish.

@fabiangreffrath
Copy link
Collaborator

Hm, you don't check stat()'s return value. On success, it should return 0. If it doesn't return 0, this should be treated just the same as if the directory doesn't exist.

if (stat(base, &data_dir) || !S_ISDIR(data_dir.st_mode))

@facespkz
Copy link
Contributor Author

After running this about 50 times it looks like it works, so I'll follow this up with another PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants