for nomsupath in package.nomsupath\gmatch("[^;]+")
break if browse(nomsupath.."/"..path)
return nil
else
ret = os.execute('find . -maxdepth 0')
unless ret == true or ret == 0
error "Could not find 'luafilesystem' module and couldn't run system command `find` (this might happen on Windows). Please install `luafilesystem` (which can be found at: http://keplerproject.github.io/luafilesystem/ or `luarocks install luafilesystem`)", 0
files.walk = (path)->
-- Sanitize path
if match(path, "%.nom$") or match(path, "%.lua$") or match(path, "^/dev/fd/[012]$")
return iterate_single, path
-- TODO: improve sanitization
path = gsub(path,"\\","\\\\")
path = gsub(path,"`","")
path = gsub(path,'"','\\"')
path = gsub(path,"$","")
return coroutine.wrap ->
f = io.popen('find -L "'..path..'" -not -path "*/\\.*" -type f -name "*.nom"')
found = false
for line in f\lines!
found = true
coroutine.yield(line)
if not found and package.nomsupath
f\close!
for nomsupath in package.nomsupath\gmatch("[^;]+")
f = io.popen('find -L "'..package.nomsupath..'/'..path..'" -not -path "*/\\.*" -type f -name "*.nom"')