git.fiddlerwoaroof.com
Browse code

chore: cleanup resource file access

Edward Langley authored on 11/10/2019 01:57:47
Showing 2 changed files
... ...
@@ -84,9 +84,7 @@
84 84
    (alexandria:read-file-into-string
85 85
     (if account-source
86 86
         account-source
87
-        (merge-pathnames (make-pathname :name "accounts"
88
-                                        :type "json")
89
-                         (bundle-resource-root))))))
87
+        (json-resource "accounts")))))
90 88
 
91 89
 (defun reprocess-accounts (accounts)
92 90
   (let ((accounts (gethash "Accounts" accounts))
... ...
@@ -8,9 +8,14 @@
8 8
                                     "pathForResource:ofType:" "app" "icns"))))
9 9
 
10 10
 (defun bundle-resource (relpath)
11
-  (merge-pathnames relpath
11
+  (merge-pathnames (namestring relpath)
12 12
                    (bundle-resource-root)))
13 13
 
14
+(defun json-resource (path)
15
+  (bundle-resource
16
+   (merge-pathnames (make-pathname :type "json")
17
+                    path)))
18
+
14 19
 (defun clear-cookies ()
15 20
   (let ((cookie-storage (objc:invoke "NSHTTPCookieStorage" "sharedHTTPCookieStorage")))
16 21
     (map nil