defaults.scm 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ;;; defaults.scm --- Default file names for Guile-Daemon
  2. ;; Copyright © 2016, 2018, 2020 Alex Kost <alezost@gmail.com>
  3. ;; This file is part of Guile-Daemon.
  4. ;; Guile-Daemon is free software; you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation, either version 3 of the License, or
  7. ;; (at your option) any later version.
  8. ;;
  9. ;; Guile-Daemon is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;;
  14. ;; You should have received a copy of the GNU General Public License
  15. ;; along with Guile-Daemon. If not, see <http://www.gnu.org/licenses/>.
  16. ;;; Commentary:
  17. ;; This module provides variables to find default files and directories
  18. ;; for guile-daemon.
  19. ;;; Code:
  20. (define-module (daemon defaults)
  21. #:use-module (srfi srfi-26)
  22. #:export (%default-config-directory
  23. %default-socket-directory
  24. %default-config-file
  25. %default-fifo-file
  26. %default-socket-file))
  27. (define %default-config-directory
  28. ;; File name of the default configuration directory.
  29. (string-append (or (getenv "XDG_CONFIG_HOME")
  30. (and=> (getenv "HOME")
  31. (cut string-append <> "/.config")))
  32. "/guile-daemon"))
  33. (define %default-socket-directory
  34. ;; File name of the default directory for FIFO and socket files.
  35. (or (and=> (getenv "XDG_RUNTIME_DIR")
  36. (cut string-append <> "/guile-daemon"))
  37. (string-append %default-config-directory "/run")))
  38. (define %default-config-file
  39. ;; File name of the default user configuration.
  40. (string-append %default-config-directory "/init.scm"))
  41. (define %default-fifo-file
  42. ;; File name of the default FIFO file.
  43. (string-append %default-socket-directory "/fifo"))
  44. (define %default-socket-file
  45. ;; File name of the default socket file.
  46. (string-append %default-socket-directory "/socket"))
  47. ;;; defaults.scm ends here