From: Gordon Hecker Date: Mon, 9 Nov 2009 18:29:04 +0000 (+0100) Subject: e2lib: use e2util.stat instead of calling test -f X-Git-Tag: e2factory-2.3.3rc1~19 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=a7f529f133f8b4f96fd7b9c9f373bb6f0c7eaa5e;p=e2factory.git e2lib: use e2util.stat instead of calling test -f Signed-off-by: Gordon Hecker --- diff --git a/Changelog b/Changelog index 5f9117f..81c7db9 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ NEXT: * use sha1 module instead of calling the sha1sum tool + * optimization: use stat() instead of calling 'test -f' e2factory-2.3.2 * temporary build directories are located in a version specific directory diff --git a/generic/e2lib.lua b/generic/e2lib.lua index e09f919..b37ce02 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -1685,8 +1685,11 @@ end -- @param dir string: path -- @return bool function e2lib.isfile(path) - local args = string.format("-f '%s'", path) - return e2lib.call_tool("test", args) + local t = e2util.stat(path, true) + if not t or t.type ~= "regular" then + return false + end + return true end --- check if path is a file