xdg_user_dir.cr
1.0.0
This is a thin wrapper around xdg_user_dir_lookup C function from
xdg-user-dirs, the C code is linked statically and has no
dependencies.
This is useful if you don't want to spawn a new process just to fetch some value from xdg-user-dir program.
Maybe in the future I could port the C code to Crystal and let this be pure Crystal, a PR with spec tests are welcome.
If your application uses GLib, the functionality provided by this shard is available in the GLib.html#user_special_dir function.
Add the dependency to your shard.yml:
dependencies:
xdg_user_dir:
github: hugopl/xdg_user_dir.crRun shards install
require "xdg_user_dir"
# You can query the default locations in a type safe way
XdgUserDir.lookup(:documents) #=> "/home/joe/Documents"
# Or using a string to access custom locations
XdgUserDir.lookup("MUSIC") #=> "/home/joe/Music"As you can check in the API docs, it's a single function API shard ?.
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)