projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4ab5b41
)
libs/core: implement fs.isdirectory()
author
Jo-Philipp Wich
<jow@openwrt.org>
Fri, 19 Dec 2008 12:08:51 +0000
(12:08 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Fri, 19 Dec 2008 12:08:51 +0000
(12:08 +0000)
libs/core/luasrc/fs.lua
patch
|
blob
|
history
diff --git
a/libs/core/luasrc/fs.lua
b/libs/core/luasrc/fs.lua
index
abea5b5
..
830536c
100644
(file)
--- a/
libs/core/luasrc/fs.lua
+++ b/
libs/core/luasrc/fs.lua
@@
-54,12
+54,19
@@
access = posix.access
glob = posix.glob
--- Checks wheather the given path exists and points to a regular file.
glob = posix.glob
--- Checks wheather the given path exists and points to a regular file.
--- @param filename String containing the path of the file to
read
+-- @param filename String containing the path of the file to
test
-- @return Boolean indicating wheather given path points to regular file
function isfile(filename)
return posix.stat(filename, "type") == "regular"
end
-- @return Boolean indicating wheather given path points to regular file
function isfile(filename)
return posix.stat(filename, "type") == "regular"
end
+--- Checks wheather the given path exists and points to a directory.
+-- @param dirname String containing the path of the directory to test
+-- @return Boolean indicating wheather given path points to directory
+function isdirectory(dirname)
+ return posix.stat(dirname, "type") == "directory"
+end
+
--- Read the whole content of the given file into memory.
-- @param filename String containing the path of the file to read
-- @return String containing the file contents or nil on error
--- Read the whole content of the given file into memory.
-- @param filename String containing the path of the file to read
-- @return String containing the file contents or nil on error