Adds lookup to the XDG_DATA_DIRS for the wayland session files - #123
avpcretois wants to merge 3 commits into
Conversation
|
Hi, thanks for contributing! This is a useful fix, which mostly does the right thing. Since it's a draft I'll give you some honest feedback now: The implementation feels overly complex for what it does, and I think it's due to your choice of data structure. A fixed-size array would do the job just as well, and you wouldn't have to worry about pointer plumbing and memory management, which currently half of the code amounts to. True, we'd lose some flexibility, but I think the reduced complexity outweighs this. In particular there are two blocking bugs that are a direct consequence of this complexity. They both originate with the
If you use a fixed-size array, you could avoid all the complexity that led to these errors. There are a couple of minor things as well, but I'll comment on those in a future round of review. |
|
Hello, Thank you for the review and testing ! Initially I used such structure to cope with the shear number of directories in XDG_DATA_DIRS on NixOS. However by filtering the ones containing a I'm going to redo it with a fixed size array. |
|
Hello, I simplified the parsing of XDG_DATA_DIRS, and tested edge cases with It also correctly finds the sessions on NixOS (with the env variable passed by the systemd service). |
Hello,
This pull request is to resolve issue : #121
I created new files to handle the parsing of the
XDG_DATA_DIRS.As this PR is mainly intended to allow a better compatibility with NixOS, I implented a check on existance of a
/wayland-sessionsdirectory in each XDG data directory. It avoids to try opening a lot of non-existent directories.I did not code in C since my teenage years, and never did professionally so I apologize for the potential mistakes I made.