aboutsummaryrefslogtreecommitdiff
path: root/files.lua
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.lua
parent965624714e41d295a998ecc29ffc1792062d94b1 (diff)
Added 'make directory' API
Diffstat (limited to 'files.lua')
-rw-r--r--files.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/files.lua b/files.lua
index 0c8558d..680cdb4 100644
--- a/files.lua
+++ b/files.lua
@@ -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)* |}