File tree 3 files changed +33
-14
lines changed
3 files changed +33
-14
lines changed Original file line number Diff line number Diff line change @@ -176,20 +176,6 @@ split-path: func [
176
176
reduce [dir pos]
177
177
]
178
178
179
- wildcard : func [
180
- "Return block of absolute path files filtered using wildcards."
181
- path [file! ] "Source directory"
182
- value [any-string! ] "Search value with possible * and ? wildcards"
183
- /local result
184
- ] [
185
- result: make block! 8
186
- path: clean-path/dir path
187
- foreach file read path [
188
- if find/match/any file value [ append result path/: file ]
189
- ]
190
- new-line /all result true
191
- ]
192
-
193
179
intern : function [
194
180
"Imports (internalize) words and their values from the lib into the user context."
195
181
data [block! any-word! ] "Word or block of words to be added (deeply)"
Original file line number Diff line number Diff line change @@ -62,6 +62,20 @@ clean-path: func [
62
62
reverse out
63
63
]
64
64
65
+ wildcard : func [
66
+ "Return block of absolute path files filtered using wildcards."
67
+ path [file! ] "Source directory"
68
+ value [any-string! ] "Search value with possible * and ? wildcards"
69
+ /local result
70
+ ] [
71
+ result: make block! 8
72
+ path: clean-path/dir path
73
+ foreach file read path [
74
+ if find/match/any file value [ append result path/: file ]
75
+ ]
76
+ new-line /all result true
77
+ ]
78
+
65
79
input : func [
66
80
{Inputs a string from the console.}
67
81
/hide "Turns off echoing inputs"
Original file line number Diff line number Diff line change @@ -76,4 +76,23 @@ secure [%/ allow]
76
76
delete %temp.txt
77
77
===end-group===
78
78
79
+ ===start-group=== "WILDCARD"
80
+ --test-- "wildcard *"
81
+ --assert all [
82
+ block? files: wildcard %units/files/ %*.zip
83
+ empty? find/last/tail files/1 %.zip
84
+ ]
85
+ --assert empty? wildcard %units/files/ %*.something
86
+ --test-- "wildcard ?"
87
+ --assert all [
88
+ block? files: wildcard %units/files/ %issue-2186-UTF??-BE.txt
89
+ 2 = length? files
90
+ ]
91
+ --test-- "wildcard *?*"
92
+ --assert all [
93
+ block? probe files: wildcard %units/files/ %*2186-UTF??*.txt
94
+ 4 = length? files
95
+ ]
96
+ ===end-group===
97
+
79
98
~~~end-file~~~
You can’t perform that action at this time.
0 commit comments