-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestScanning.oz
48 lines (46 loc) · 1.16 KB
/
testScanning.oz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
declare
{Inspector.configure widgetShowStrings true}
fun {GetS UrlV}
FileO = {New Open.file init(name: UrlV
flags: [read text])}
S
{FileO read(list: S
size: all)}
{FileO close}
in
S
end
fun {IsSubstring SubS S}
Ss = {String1.splitAtMost S SubS 1}
in
{Length Ss}==2
end
[Path] = {Module.link ['x-oz://system/os/Path.ozf']}
[String1] = {Module.link ['x-oz://system/String.ozf']}
fun {GetFileNames DirS ExcludeFileNameSs ExtensionS SubS}
OldCDS = {OS.getCWD}
{OS.chDir DirS}
FileNameSs = {OS.getDir '.'}
ExcludeFileNameSs1 = {Append ExcludeFileNameSs ["." ".."]}
FileNameSs1 = {Filter FileNameSs
fun {$ FileNameS}
{Not {Member FileNameS ExcludeFileNameSs1}} andthen
{Path.extension FileNameS}==ExtensionS andthen
{IsSubstring SubS {GetS FileNameS}}
end}
{OS.chDir OldCDS}
in
FileNameSs1
end
FileNameSs = {GetFileNames
"Solver/Principles"
["makefile.oz" "Helpers.oz" "Principles.oz"]
"oz"
"principle.barriersPW"}
{Inspect FileNameSs}
FileNameSs1 = {GetFileNames
"Solver/Principles/Source"
nil
"ul"
"principle.barriersPW"}
{Inspect FileNameSs1}