From a7f529f133f8b4f96fd7b9c9f373bb6f0c7eaa5e Mon Sep 17 00:00:00 2001 From: Gordon Hecker Date: Mon, 9 Nov 2009 19:29:04 +0100 Subject: [PATCH] e2lib: use e2util.stat instead of calling test -f Signed-off-by: Gordon Hecker --- Changelog | 1 + generic/e2lib.lua | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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 -- 2.39.5