diff options
| author | 2012-12-24 01:27:14 +0100 | |
|---|---|---|
| committer | 2012-12-24 01:27:14 +0100 | |
| commit | 77c7dbaa9ae845b0795f4da33eb0d285f6b9d1c4 (patch) | |
| tree | 0168de30ce7b4107ed13fc57974f95850ea88e73 /paths.scm | |
| download | markam-77c7dbaa9ae845b0795f4da33eb0d285f6b9d1c4.tar.gz markam-77c7dbaa9ae845b0795f4da33eb0d285f6b9d1c4.zip | |
Initial commit
Diffstat (limited to 'paths.scm')
| -rw-r--r-- | paths.scm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/paths.scm b/paths.scm new file mode 100644 index 0000000..50bd622 --- /dev/null +++ b/paths.scm @@ -0,0 +1,17 @@ +;;; paths.scm -- Functions which work with/on paths +(declare (unit paths)) + +(define (stored-file xdg-env file) + (let ((xdg (get-environment-variable xdg-env)) + (stored-file (string-append (get-environment-variable "HOME") "/.linkwave/" file))) + (unless (or (file-exists? stored-file) (not xdg)) + (set! stored-file (string-append xdg "/linkwave/" file))) + stored-file)) + +(: config-file (string -> string)) +(define (config-file file) + (stored-file "XDG_CONFIG_HOME" file)) + +(: data-file (string -> string)) +(define (data-file file) + (stored-file "XDG_DATA_HOME" file)) |
