Add docstrings
This commit is contained in:
parent
b4afed50e1
commit
32c77a5df7
1 changed files with 5 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
(in-package :ml-survey)
|
(in-package :ml-survey)
|
||||||
|
|
||||||
(defun base-dir ()
|
(defun base-dir ()
|
||||||
|
"Determine and return the base directory for application data based on the operating system."
|
||||||
(let ((os (uiop:detect-os)))
|
(let ((os (uiop:detect-os)))
|
||||||
(cond ((eq os :os-windows) (truename "~/AppData/Local/"))
|
(cond ((eq os :os-windows) (truename "~/AppData/Local/"))
|
||||||
((eq os :os-unix) (truename "~/.local/share/"))
|
((eq os :os-unix) (truename "~/.local/share/"))
|
||||||
|
@ -8,12 +9,15 @@
|
||||||
(t (error "Unsupported OS")))))
|
(t (error "Unsupported OS")))))
|
||||||
|
|
||||||
(defun app-dir ()
|
(defun app-dir ()
|
||||||
|
"Construct and return the application-specific directory path."
|
||||||
(uiop:merge-pathnames* #P"ml-survey/" (base-dir)))
|
(uiop:merge-pathnames* #P"ml-survey/" (base-dir)))
|
||||||
|
|
||||||
(defun data-dir ()
|
(defun data-dir ()
|
||||||
|
"Construct and return the directory path for storing data within the application."
|
||||||
(uiop:merge-pathnames* #P"data/surveys/" (app-dir)))
|
(uiop:merge-pathnames* #P"data/surveys/" (app-dir)))
|
||||||
|
|
||||||
(defun ensure-data-dir ()
|
(defun ensure-data-dir ()
|
||||||
|
"Ensure the data directory exists, create it if necessary, and return its path."
|
||||||
(let ((data-dir (data-dir)))
|
(let ((data-dir (data-dir)))
|
||||||
(ensure-directories-exist (data-dir))
|
(ensure-directories-exist (data-dir))
|
||||||
data-dir))
|
data-dir))
|
||||||
|
@ -29,6 +33,7 @@
|
||||||
(truename pathname))
|
(truename pathname))
|
||||||
|
|
||||||
(defun ensure-data-file-exist (survey-id questionnaire-id)
|
(defun ensure-data-file-exist (survey-id questionnaire-id)
|
||||||
|
"Ensure that a specific file for given survey and questionnaire IDs exists within the data directory."
|
||||||
(let ((path (format nil "~a~a/~a.lisp"
|
(let ((path (format nil "~a~a/~a.lisp"
|
||||||
(ensure-data-dir)
|
(ensure-data-dir)
|
||||||
survey-id
|
survey-id
|
||||||
|
|
Loading…
Add table
Reference in a new issue