diff --git a/src/fileops.lisp b/src/fileops.lisp index 552e62e..5f62dc6 100644 --- a/src/fileops.lisp +++ b/src/fileops.lisp @@ -2,17 +2,10 @@ (defun base-dir () (let ((os (uiop:detect-os))) - (uiop:parse-native-namestring - (cond ((eq os :os-windows) - (format nil "~a/" (uiop:getenv "LOCALAPPDATA"))) - - ((eq os :os-unix) - (format nil "~a/.local/share/" (user-homedir-pathname))) - - ((eq os :os-macos) - (format nil "~a/Library/Application Support/" (user-homedir-pathname))) - - (t (error "Unsupported OS")))))) + (cond ((eq os :os-windows) (truename "~/AppData/Local/")) + ((eq os :os-unix) (truename "~/.local/share/")) + ((eq os :os-macos) (truename "~/Library/Application Support/")) + (t (error "Unsupported OS"))))) (defun app-dir () (uiop:merge-pathnames* #P"ml-survey/" (base-dir))) @@ -33,15 +26,14 @@ :if-exists :overwrite :if-does-not-exist :create) (format stream ""))) - pathname) + (truename pathname)) (defun ensure-data-file-exist (survey-id questionnaire-id) (let ((path (format nil "~a~a/~a.lisp" (ensure-data-dir) survey-id questionnaire-id))) - (ensure-directories-exist path) - (ensure-file-exist path))) + (ensure-file-exist (ensure-directories-exist path)))) (defun make-db-file (file) "Prepare and ensure a database file at FILE-STR path." @@ -49,7 +41,6 @@ (let ((path (uiop:merge-pathnames* file (ensure-data-dir)))) (ensure-file-exist path))) - (defun load-response (db) (check-type db (or string pathname)) (with-open-file (stream db