]> gitweb.factorcode.org Git - factor.git/commitdiff
globs: fix glob for literal path.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 17 Sep 2016 00:41:31 +0000 (17:41 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 17 Sep 2016 00:41:31 +0000 (17:41 -0700)
basis/globs/globs-tests.factor
basis/globs/globs.factor

index d90c8dc3a9ee06385357d302de9585336db3f485..0adc3b0290fa30c18e6c78d0feb6e170a4b2b462 100755 (executable)
@@ -58,6 +58,8 @@ tools.test ;
     ! { "a/b/c/d/e" "a/b/h/e" "a/e" "a/e/g/e" }
     { "a/e/f" "a/e/g" }
     { "a/b" "a/e" }
+    { "a" }
+    { "a/b" }
 } [
 
     [
@@ -85,5 +87,7 @@ tools.test ;
         ! "**/**/e" glob natural-sort
         "**/e/**" glob natural-sort
         "a/**" glob natural-sort
+        "a" glob natural-sort
+        "a/b" glob natural-sort
     ] with-test-directory
 ] unit-test
index 3d9f7d857b548b103363d98a62cccd772cddcf13..8ee3fa06c626d59ccec7f72d84807aba567537eb 100644 (file)
@@ -156,4 +156,6 @@ DEFER: glob%
 PRIVATE>
 
 : glob ( glob -- files )
-    glob-path [ glob% ] { } make ;
+    glob-path [
+        [ 1array f swap ] when-empty glob%
+    ] { } make ;