From: Tobias Ulmer Date: Fri, 6 Dec 2013 14:34:44 +0000 (+0100) Subject: transport: Fix wrong documentation for file_path() X-Git-Tag: e2factory-2.3.15rc1~291 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=a4b982fa00d9316b24ede390eb885c75044a5bfa;p=e2factory.git transport: Fix wrong documentation for file_path() Signed-off-by: Tobias Ulmer --- 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)