diff options
| -rw-r--r-- | files.lua | 6 | ||||
| -rw-r--r-- | files.moon | 7 | ||||
| -rw-r--r-- | lib/filesystem/init.nom | 3 |
3 files changed, 13 insertions, 3 deletions
@@ -89,6 +89,9 @@ Files.list = function(path) end return _BROWSE_CACHE[path] end +Files.make_directory = function(path) + return run_cmd('mkdir ' .. path) +end local ok, lfs = pcall(require, "lfs") if ok then local raw_file_exists @@ -157,6 +160,7 @@ if ok then end return _BROWSE_CACHE[path] end + Files.make_directory = lfs.mkdir else if not (run_cmd('find . -maxdepth 0')) then local url @@ -165,7 +169,7 @@ else else url = 'https://github.com/keplerproject/luafilesystem' end - 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: " .. tostring(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: " .. tostring(url) .. " or `luarocks install luafilesystem`)\n" .. tostring(lfs) .. "\npackage.cpath: " .. tostring(package.cpath), 0) end end local line_counter = re.compile([[ lines <- {| line (%nl line)* |} @@ -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)* |} diff --git a/lib/filesystem/init.nom b/lib/filesystem/init.nom index 3e819f8..4ce21e4 100644 --- a/lib/filesystem/init.nom +++ b/lib/filesystem/init.nom @@ -31,6 +31,7 @@ external: $file, line number at $source.stop ..: add ($file, line $) ], joined with "\n" - + $(spoof file $text) = $Files.spoof $(spoof file $filename = $text) = $Files.spoof + $(make directory $path) = $Files.make_directory |
