]> gitweb.factorcode.org Git - factor.git/commitdiff
io.pathnames: shorter absolute-path.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 2 Mar 2021 20:47:10 +0000 (12:47 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 2 Mar 2021 20:47:10 +0000 (12:47 -0800)
core/io/pathnames/pathnames.factor

index b54b207bca2ed5098c94d4336a84426766525f0a..5433b4594dd08165694cb534778a33b66eb1def2 100644 (file)
@@ -147,21 +147,12 @@ GENERIC: vocab-path ( path -- newpath )
 GENERIC: absolute-path ( path -- path' )
 
 M: string absolute-path
-    "resource:" ?head [
-        trim-head-separators resource-path
-        absolute-path
-    ] [
-        "vocab:" ?head [
-            trim-head-separators vocab-path
-            absolute-path
-        ] [
-            "~" ?head [
-                trim-head-separators home prepend-path
-                absolute-path
-        ] [
-            current-directory get prepend-path
-        ] if ] if
-    ] if ;
+    {
+        { [ "resource:" ?head ] [ trim-head-separators resource-path absolute-path ] }
+        { [ "vocab:" ?head ] [ trim-head-separators vocab-path absolute-path ] }
+        { [ "~" ?head ] [ trim-head-separators home prepend-path absolute-path ] }
+        [ current-directory get prepend-path ]
+    } cond ;
 
 M: object normalize-path
     absolute-path ;