summaryrefslogtreecommitdiffstats
path: root/src/mac/create-folder.mpw
blob: 159eb1297546c4fbca20e2255fb171b879aefa86 (plain)
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
### usage: create-folder path
###
### path must be path to a folder (can be relative path)
### creates the folder and its parents if necessary

### Create path components of path one at a time
set left-part ""
set right-part "{1}"

loop
	if "{right-part}" == ""
		break
	end
	
	(evaluate "{right-part}" =~ /([Â:]*:)¨1Å/) > Dev:Null
	set car "{¨1}"
	(evaluate "{right-part}" =~ /[Â:]*:(Å)¨1/) > Dev:Null
	set cdr "{¨1}"
	
	set left-part "{left-part}{car}"
	set right-part "{cdr}"

	if not (`Exists "{left-part}"`)	
		NewFolder "{left-part}"
	end
end