From: Tobias Ulmer Date: Thu, 21 Feb 2013 12:23:01 +0000 (+0100) Subject: Return false instead of nil in locate_project_root() X-Git-Tag: e2factory-2.3.13rc1~4 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=de41f4dc251653652ce6db732840e2c90b6843e6;p=e2factory.git Return false instead of nil in locate_project_root() Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 3d38bb6..3a528e1 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -1184,27 +1184,26 @@ end -- then the current working directory is taken as the base directory from -- where to start. -- @param path Project directory (string) or nil. --- @return Absolute base project directory or nil on error. --- XXX: change nil to false. +-- @return Absolute base project directory or false on error. -- @return Error object on failure. function e2lib.locate_project_root(path) local rc, re local e = err.new("checking for project directory failed") local save_path = e2util.cwd() if not save_path then - return nil, e:append("cannot get current working directory") + return false, e:append("cannot get current working directory") end if path then rc = e2lib.chdir(path) if not rc then e2lib.chdir(save_path) - return nil, e:cat(re) + return false, e:cat(re) end else path = e2util.cwd() if not path then e2lib.chdir(save_path) - return nil, e:append("cannot get current working directory") + return false, e:append("cannot get current working directory") end end while true do @@ -1219,16 +1218,16 @@ function e2lib.locate_project_root(path) rc = e2lib.chdir("..") if not rc then e2lib.chdir(save_path) - return nil, e:cat(re) + return false, e:cat(re) end path = e2util.cwd() if not path then e2lib.chdir(save_path) - return nil, e:append("cannot get current working directory") + return false, e:append("cannot get current working directory") end end e2lib.chdir(save_path) - return nil, err.new("not in a project directory") + return false, err.new("not in a project directory") end --- Checks whether the tool is an existing global e2factory tool. Note that