From a4b982fa00d9316b24ede390eb885c75044a5bfa Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Fri, 6 Dec 2013 15:34:44 +0100 Subject: [PATCH] transport: Fix wrong documentation for file_path() Signed-off-by: Tobias Ulmer --- generic/transport.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/generic/transport.lua b/generic/transport.lua index c0fbb04..cf34665 100644 --- a/generic/transport.lua +++ b/generic/transport.lua @@ -385,22 +385,22 @@ function transport.push_file(sourcefile, durl, location, push_permissions, try_h return true, nil end ---- fetch a file from a server --- @param surl url to the server --- @param location location relative to the server url --- @return true on success, false on error --- @return nil, an error string on error +--- Get file path to the specified location, if the file is locally accessable. +-- It's the responsibilty of the caller to check whether the file exists. +-- @param surl Url to the server. +-- @param location Location relative to the server url. +-- @return File path on success, false on error. +-- @return Error string on failure. function transport.file_path(surl, location) local e = err.new("can't get path to file") local u, re = url.parse(surl) if not u then - return nil, e:cat(re) + return false, e:cat(re) end if u.transport ~= "file" then - return nil, e:append("transport does not support file_path()") + return false, e:append("transport does not support file_path()") end - local path = string.format("/%s/%s", u.path, location) - return path + return string.format("/%s/%s", u.path, location) end return strict.lock(transport) -- 2.39.5