Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stevedonovan/Penlight.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorwangqr <wangqr@wangqr.tk>2021-06-06 20:15:02 +0300
committerThijs Schreijer <thijs@thijsschreijer.nl>2021-06-11 15:21:38 +0300
commit5a92f6a78609948497a585adc9365fb0f3ccf75b (patch)
tree6e5bf8a3566c5ef41878910a70e6c44f4f813f46 /lua
parent19c863ed5a28fc25b6031fef46fc83add51a7169 (diff)
fix(path) currentdir does not accept parameters
Diffstat (limited to 'lua')
-rw-r--r--lua/pl/path.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/lua/pl/path.lua b/lua/pl/path.lua
index 66d83f6..a438a9d 100644
--- a/lua/pl/path.lua
+++ b/lua/pl/path.lua
@@ -33,10 +33,15 @@ local link_attrib = lfs.symlinkattributes
local path = {}
local function err_func(name, param, err, code)
- if code == nil then
- return ("%s failed for '%s': %s"):format(tostring(name), tostring(param), tostring(err))
+ local ret = ("%s failed"):format(tostring(name))
+ if param ~= nil then
+ ret = ret .. (" for '%s'"):format(tostring(param))
end
- return ("%s failed for '%s': %s (code %s)"):format(tostring(name), tostring(param), tostring(err), tostring(code))
+ ret = ret .. (": %s"):format(tostring(err))
+ if code ~= nil then
+ ret = ret .. (" (code %s)"):format(tostring(code))
+ end
+ return ret
end
--- Lua iterator over the entries of a given directory.
@@ -80,10 +85,10 @@ end
--- Get the working directory.
-- Implicit link to [`luafilesystem.currentdir`](https://keplerproject.github.io/luafilesystem/manual.html#reference)
-- @function currentdir
-path.currentdir = function(d)
- local ok, err, code = currentdir(d)
+path.currentdir = function()
+ local ok, err, code = currentdir()
if not ok then
- return ok, err_func("currentdir", d, err, code), code
+ return ok, err_func("currentdir", nil, err, code), code
end
return ok, err, code
end