aboutsummaryrefslogtreecommitdiff
path: root/files.moon
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-01-27 02:01:57 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-01-27 02:02:03 -0800
commit3142ef46a3385b209f29d843cf20c8f02ad65905 (patch)
tree4c1b4a9ad6c9166e266e6053fc725e35e921422f /files.moon
parent965624714e41d295a998ecc29ffc1792062d94b1 (diff)
Added 'make directory' API
Diffstat (limited to 'files.moon')
-rw-r--r--files.moon7
1 files changed, 6 insertions, 1 deletions
diff --git a/files.moon b/files.moon
index a9fbb5c..a86f60d 100644
--- a/files.moon
+++ b/files.moon
@@ -60,6 +60,9 @@ Files.list = (path)->
else run_cmd('find -L "'..path..'" -not -path "*/\\.*" -type f') or false
return _BROWSE_CACHE[path]
+Files.make_directory = (path)->
+ run_cmd('mkdir '..path)
+
ok, lfs = pcall(require, "lfs")
if ok
raw_file_exists = (filename)->
@@ -92,12 +95,14 @@ if ok
for i,f in ipairs(_BROWSE_CACHE[path])
if f\match("^%./") then _BROWSE_CACHE[path][i] = f\sub(3)
return _BROWSE_CACHE[path]
+
+ Files.make_directory = lfs.mkdir
else
unless run_cmd('find . -maxdepth 0')
url = if jit
'https://github.com/spacewander/luafilesystem'
else 'https://github.com/keplerproject/luafilesystem'
- 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: #{url} or `luarocks install luafilesystem`)", 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: #{url} or `luarocks install luafilesystem`)\n#{lfs}\npackage.cpath: #{package.cpath}", 0
line_counter = re.compile([[
lines <- {| line (%nl line)* |}