Transcript clear.
[(WikitextModule allSubclasses select:[:module | (module pagetitle indexOf:$/ ifAbsent:[0]) > 0])
do:[:m | |ss f d cmd shell content ios|
ss := m pagetitle squeakToUtf8 findBetweenSubStrs: '/'.
d := ss collect:[:each | each] from: 1 to: (ss size -1).
"handle Sandbox and User: here"
((d at:1) = 'Sandbox') | ((d at:1) beginsWith:'User:')
ifTrue:[]
ifFalse:[
d := d inject:'' into:[:a :b | a, '/', b].
f := ('lua',d, '/', ss last, '.lua') squeakToUtf8 . "ios writes to shared by default"
cmd := 'mkdir -p shared/lua', d. "commandshell writes to squeak root directory, so we prepende 'shared' to it"
Transcript show: (m name), ' : ', cmd; cr.
shell := PipeableOSProcess bash.
shell pipeFromOutput reader setNonBlocking.
shell exec: cmd.
(Delay forMilliseconds: 400) wait.
Transcript show: shell upToEnd ; cr.
shell close.
content := m lua squeakToUtf8.
ios := FileStream newFileNamed: f.
ios isNil
ifFalse:[
content storeOn: ios.
ios close.
]].
]] ifError:[:x :y | Transcript show: x;cr. y close. thisContext resume]