aboutsummaryrefslogtreecommitdiff
path: root/files.moon
diff options
context:
space:
mode:
Diffstat (limited to 'files.moon')
-rw-r--r--files.moon10
1 files changed, 3 insertions, 7 deletions
diff --git a/files.moon b/files.moon
index becc3fb..e0fe02b 100644
--- a/files.moon
+++ b/files.moon
@@ -33,7 +33,6 @@ Files.read = (filename)->
_FILE_CACHE[filename] = contents
return contents
--- `walk` returns an iterator over all files matching a path.
{:match, :gsub} = string
-- TODO: improve sanitization
@@ -108,12 +107,9 @@ Files.walk = (path, flush_cache=false)->
else
for nomsupath in package.nomsupath\gmatch("[^;]+")
if files = browse(nomsupath.."/"..path) then break
- iter = (files, i)->
- return unless files
- i += 1
- if f = files[i]
- return i, f
- return iter, files, 0
+ files or= {}
+ files = [gsub(f, "^%./", "") for f in *files]
+ return ipairs(files)
line_counter = re.compile([[
lines <- {| line (%nl line)* |}