]> git.e2factory.org Git - e2factory.git/commitdiff
e2lib: use e2util.stat instead of calling test -f
authorGordon Hecker <gh@emlix.com>
Mon, 9 Nov 2009 18:29:04 +0000 (19:29 +0100)
committerGordon Hecker <gh@emlix.com>
Wed, 18 Nov 2009 09:10:31 +0000 (10:10 +0100)
Signed-off-by: Gordon Hecker <gh@emlix.com>
Changelog
generic/e2lib.lua

index 5f9117f564c9c9f292fe73f1ff005ceba08e84c5..81c7db9b6146e3844536e693a1caaa27eabf192b 100644 (file)
--- 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
index e09f919a3cfe7499d930851ebbe52e8fafa5b7bb..b37ce02c24490c348c96a97a77868e6ff172cc77 100644 (file)
@@ -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