waycrate / swhkd

Sxhkd clone for Wayland (works on TTY and X11 too)
https://git.sr.ht/~shinyzenith/swhkd
BSD 2-Clause "Simplified" License
666 stars 47 forks source link

Proposal: Better Path handling Mechanisms #240

Closed newtoallofthis123 closed 3 months ago

newtoallofthis123 commented 4 months ago

In the codebase, there are many places, especially within swhks where filenames and paths have been manipulated using strings and with no sufficient checks in place as to whether they exist or the user has permission to access them.

This proposal is to use high efficient crates like path_abs and dirs along with some higher order use of functions in order to fix this issue.

Some examples of this in the code base are: swhks/src/main.rs line: 160, 161, 67 main/swhkd/src/daemon.rs line: 567, 561

Moreover, the usuage of env variables can be centralised and validated, reducing code complexity and the use of crate: path_abs would provide good validations as well

This issue is a proposal to make these changes and I am ready to go more into the details of it

newtoallofthis123 commented 4 months ago

Addressed in PR #243

Shinyzenith commented 4 months ago

Hi, this isn't complete yet as swhkd now needs the same transforms.

newtoallofthis123 commented 4 months ago

Also addressed in #246