rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.41k stars 213 forks source link

Add support for non-default XDG user dir in an install script for the Linux #767

Open Toreno96 opened 1 year ago

Toreno96 commented 1 year ago

According to the https://wiki.archlinux.org/title/XDG_user_directories and https://www.freedesktop.org/wiki/Software/xdg-user-dirs/, Linux users can customize their "user directories" to be in a different paths than the default ~/Downloads etc. However, the install script hardcoded this path so far, which caused a failure for such users, e.g.

$ ./install/linux.sh 
/home/dstasczak/Downloads/kinto.zip: No such file or directory
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Warning: Failed to open the file /home/dstasczak/Downloads/kinto.zip: No such 
Warning: file or directory
100   512    0   512    0     0    751      0 --:--:-- --:--:-- --:--:--   751
curl: (23) Failure writing output to destination
unzip:  cannot find or open /home/dstasczak/Downloads/kinto.zip, /home/dstasczak/Downloads/kinto.zip.zip or /home/dstasczak/Downloads/kinto.zip.ZIP.
…

This PR is supposed to fix that.

In case the fallback hardcoded path is used, there will be an error message written to the STDERR:

$ ./install/linux.sh 
./install/linux.sh: line 7: xdg-user-dir: command not found

This is the default error message that bash shows in case it cannot find a specific command, I think it's clear enough not to require implementing any custom handling. Let me know if you agree or not :slightly_smiling_face: