libs/core: implement fs.isdirectory()
This commit is contained in:
parent
4ab5b4165a
commit
0c3f77a397
1 changed files with 8 additions and 1 deletions
|
@ -54,12 +54,19 @@ access = posix.access
|
||||||
glob = posix.glob
|
glob = posix.glob
|
||||||
|
|
||||||
--- Checks wheather the given path exists and points to a regular file.
|
--- 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
|
-- @return Boolean indicating wheather given path points to regular file
|
||||||
function isfile(filename)
|
function isfile(filename)
|
||||||
return posix.stat(filename, "type") == "regular"
|
return posix.stat(filename, "type") == "regular"
|
||||||
end
|
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.
|
--- Read the whole content of the given file into memory.
|
||||||
-- @param filename String containing the path of the file to read
|
-- @param filename String containing the path of the file to read
|
||||||
-- @return String containing the file contents or nil on error
|
-- @return String containing the file contents or nil on error
|
||||||
|
|
Loading…
Reference in a new issue