diff --git a/src/mezz/base-files.reb b/src/mezz/base-files.reb index b3ff5f44ee..0bde2d013c 100644 --- a/src/mezz/base-files.reb +++ b/src/mezz/base-files.reb @@ -176,20 +176,6 @@ split-path: func [ reduce [dir pos] ] -wildcard: func [ - "Return block of absolute path files filtered using wildcards." - path [file!] "Source directory" - value [any-string!] "Search value with possible * and ? wildcards" - /local result -][ - result: make block! 8 - path: clean-path/dir path - foreach file read path [ - if find/match/any file value [ append result path/:file ] - ] - new-line/all result true -] - intern: function [ "Imports (internalize) words and their values from the lib into the user context." data [block! any-word!] "Word or block of words to be added (deeply)" diff --git a/src/mezz/mezz-files.reb b/src/mezz/mezz-files.reb index 6173248f53..bdf0725f9d 100644 --- a/src/mezz/mezz-files.reb +++ b/src/mezz/mezz-files.reb @@ -62,6 +62,20 @@ clean-path: func [ reverse out ] +wildcard: func [ + "Return block of absolute path files filtered using wildcards." + path [file!] "Source directory" + value [any-string!] "Search value with possible * and ? wildcards" + /local result +][ + result: make block! 8 + path: clean-path/dir path + foreach file read path [ + if find/match/any file value [ append result path/:file ] + ] + new-line/all result true +] + input: func [ {Inputs a string from the console.} /hide "Turns off echoing inputs" diff --git a/src/tests/units/file-test.r3 b/src/tests/units/file-test.r3 index 84ff6c6eaa..4a7857e3c2 100644 --- a/src/tests/units/file-test.r3 +++ b/src/tests/units/file-test.r3 @@ -76,4 +76,23 @@ secure [%/ allow] delete %temp.txt ===end-group=== +===start-group=== "WILDCARD" + --test-- "wildcard *" + --assert all [ + block? files: wildcard %units/files/ %*.zip + empty? find/last/tail files/1 %.zip + ] + --assert empty? wildcard %units/files/ %*.something + --test-- "wildcard ?" + --assert all [ + block? files: wildcard %units/files/ %issue-2186-UTF??-BE.txt + 2 = length? files + ] + --test-- "wildcard *?*" + --assert all [ + block? probe files: wildcard %units/files/ %*2186-UTF??*.txt + 4 = length? files + ] +===end-group=== + ~~~end-file~~~ \ No newline at end of file