Linux: follow XDG guidelines#20
Conversation
illwieckz
commented
Jul 4, 2017
- use ~/.local/share/unvanquished instead of ~/.unvanquished
- move legacy path if exists
- fix Make user data and configuration directory/ies XDG-compliant. Unvanquished/Unvanquished#730
|
There is just a minor issue, the early warning is not colored: |
src/common/FileSystem.cpp
Outdated
| return std::string(home) + "/." PRODUCT_NAME_LOWER; | ||
| struct stat stl, stx; | ||
|
|
||
| std::string legacyHomePath = std::string(home) + "/." PRODUCT_NAME_LOWER; |
There was a problem hiding this comment.
Use FS::Path::Build() to build paths.
|
Note that if someone symlink |
- use ~/.local/share/unvanquished instead of ~/.unvanquished - move legacy path if exists - fix Unvanquished/Unvanquished#730
DolceTriade
left a comment
There was a problem hiding this comment.
Minor nit, but otherwise seems fine.
|
I modified my code to handle the symlink use case (if |
src/common/FileSystem.cpp
Outdated
| int fd = open(xdgDataHome.c_str(), O_DIRECTORY); | ||
|
|
||
| if (fd == -1) { | ||
| Sys::Error("Could not open XDG data directory %s", xdgDataHome); |
There was a problem hiding this comment.
include strerror(errno) at the end so we know why it failed.
src/common/FileSystem.cpp
Outdated
| ret = symlinkat(legacyHomePath.c_str(), fd, xdgHomePath.c_str()); | ||
|
|
||
| if (ret == -1) { | ||
| Sys::Error("Could not create symlink %s", xdgHomePath); |
|
|
||
| if (fd == -1) { | ||
| Sys::Error("Could not open XDG data directory %s", xdgDataHome); | ||
| Sys::Error("Could not open XDG data directory %s: %s", xdgDataHome, strerror(errno)); |
|
Do you think it's OK to merge that change in Not doing this would prevent @DefaultUser to rebase his #16 work over this code. I don't know how much this change things for him and how much he needs to rebase on this code. I guess it's OK if we say people wanting to try out for-0.51.0 are invited to symlink |
|
yes its fine |
|
@illwieckz updating #16 should be easy since all that needs to be changed in your new code are the two instances of |