Add get-folder-path from ASDF 2.25.2
authorFrancois-Rene Rideau <tunes@google.com>
Fri, 5 Oct 2012 02:51:46 +0000 (22:51 -0400)
committerFrancois-Rene Rideau <tunes@google.com>
Fri, 5 Oct 2012 02:51:46 +0000 (22:51 -0400)
package.lisp
utils.lisp

index 5a932a5..a28487b 100644 (file)
@@ -34,7 +34,8 @@
       delete-file-if-exists
       *wild* *wild-file* *wild-directory* *wild-inferiors*
       *wild-path* wilden directorize-pathname-host-device
-      find-class*)))
+      find-class*
+      get-folder-path)))
 
 (defpackage :asdf-utils
   (:use :common-lisp)
index cf7022d..d619232 100644 (file)
@@ -676,3 +676,13 @@ with given pathname and if it exists return its truename."
                   (make-pathname
                    :defaults directory :name nil :type nil :version nil
                    :directory (append prefix (make-pathname-component-logical (last dir)))))))))))
+
+(defun* get-folder-path (folder)
+  (or ;; this semi-portably implements a subset of the functionality of lispworks' sys:get-folder-path
+   #+(and lispworks mswindows) (sys:get-folder-path folder)
+   ;; read-windows-registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\AppData
+   (ecase folder
+    (:local-appdata (getenv-absolute-directory "LOCALAPPDATA"))
+    (:appdata (getenv-absolute-directory "APPDATA"))
+    (:common-appdata (or (getenv-absolute-directory "ALLUSERSAPPDATA")
+                        (subpathname* (getenv-absolute-directory "ALLUSERSPROFILE") "Application Data/"))))))