]> gitweb.factorcode.org Git - factor.git/commitdiff
io.pathnames: adding user-resource-path
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 1 Sep 2023 20:23:33 +0000 (13:23 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 1 Sep 2023 20:23:33 +0000 (13:23 -0700)
core/io/pathnames/pathnames-docs.factor
core/io/pathnames/pathnames.factor

index 638b2b7ff818e7dd66d106bc8e03dd8488ebbfc6..3adf3680fa3eb5fe099e9262641e242c887edb44 100644 (file)
@@ -81,9 +81,13 @@ HELP: root-directory?
 
 { absolute-path? windows-absolute-path? root-directory? } related-words
 
-HELP: resource-path
+HELP: site-resource-path
 { $values { "path" "a pathname string" } { "newpath" "a pathname string" } }
-{ $description "Resolve a path relative to the Factor source code location." } ;
+{ $description "Resolve a path relative to the Factor installation directory." } ;
+
+HELP: user-resource-path
+{ $values { "path" "a pathname string" } { "newpath" "a pathname string" } }
+{ $description "Resolve a path relative to the user's " { $snippet "HOME/.factor" } " directory." } ;
 
 HELP: pathname
 { $class-description "Class of path name objects. Path name objects can be created by calling " { $link <pathname> } "." } ;
index a172fe45bcb1d8a3305f2c5c1be512dd085d58d3..f67e38dcbd109166b5ee202e835757d50967c0fd 100644 (file)
@@ -151,13 +151,18 @@ HOOK: resolve-symlinks os ( path -- path' )
 
 M: object resolve-symlinks normalize-path ;
 
-: resource-path ( path -- newpath )
+: site-resource-path ( path -- newpath )
     "resource-path" get prepend-path ;
 
+ALIAS: resource-path site-resource-path
+
 HOOK: home io-backend ( -- dir )
 
 M: object home "" resource-path ;
 
+: user-resource-path ( path -- newpath )
+    home ".factor" append-path prepend-path ;
+
 : home-path ( path -- newpath ) home prepend-path ;
 
 GENERIC: vocab-path ( path -- newpath )