Module path.fs
This is lowlevel module which implement system dependent operation.
Can use LuaFileSystem or alien/ffi on Windows
Functions
currentdir () | Return current work directory path. |
attributes (P[, name=nil]) | Returns a table with the file attributes. |
flags (P) | Return file attributes. |
ctime (P) | Return creation file time. |
mtime (P) | Return last modification file time. |
atime (P) | Return last access file time. |
size (P) | Return size in bytes for file. |
exists (P) | Return path if path existing in file system. |
isdir (P) | Return path if path refers to an existing directory. |
isfile (P) | Return path if path refers to an existing file. |
islink (P) | Return path if path refers to an existing symbolic link. |
mkdir (P) | Create new directory. |
rmdir (P) | Remove empty directory. |
chdir (P) | Change current work directory path. |
copy (src, dst, force) | Copy one existed file. |
move (src, dst, flags) | Rename (move) existed file. |
remove (P) | Remove file. |
tmpdir () | Return path to system temp directory. |
touch (P, atime, ctime) | Set access and modification times of a file. |
dir () | Implimentation of lfs.dir |
each (option) | Implimentation of afx.findfile |
Tables
each_options | ??? |
Fields
DIR_SEP | The character used by the operating system to separate pathname components. |
ANY_MASK | Mask used to search all files in some dir by `fs.each`. |
Functions
- currentdir ()
- Return current work directory path.
- attributes (P[, name=nil])
-
Returns a table with the file attributes.
Parameters:
Returns:
-
table
{attr1=value1, ...}
Or
-
value attribute value if attribute name was specify
- flags (P)
-
Return file attributes.
On Windows it is result of GetFileAttributesEx
Parameters:
- P
- ctime (P)
-
Return creation file time.
On *nix this is the time of the last metadata change.
Parameters:
- P
- mtime (P)
-
Return last modification file time.
Parameters:
- P
- atime (P)
-
Return last access file time.
Parameters:
- P
- size (P)
-
Return size in bytes for file.
Parameters:
- P
- exists (P)
-
Return path if path existing in file system.
Parameters:
- P
- isdir (P)
-
Return path if path refers to an existing directory.
Parameters:
- P
- isfile (P)
-
Return path if path refers to an existing file.
Parameters:
- P
- islink (P)
-
Return path if path refers to an existing symbolic link.
Parameters:
- P
- mkdir (P)
-
Create new directory.
This function can not create nested sub directories.
Parameters:
- P
- rmdir (P)
-
Remove empty directory.
Parameters:
- P
- chdir (P)
-
Change current work directory path.
Parameters:
- P
- copy (src, dst, force)
-
Copy one existed file.
Parameters:
- src
- dst
- force
- move (src, dst, flags)
-
Rename (move) existed file.
Parameters:
- src
- dst
- flags
- remove (P)
-
Remove file.
Parameters:
- P
- tmpdir ()
- Return path to system temp directory.
- touch (P, atime, ctime)
-
Set access and modification times of a file.
Parameters:
- P
- atime
- ctime
- dir ()
- Implimentation of lfs.dir
- each (option)
-
Implimentation of afx.findfile
Parameters:
- option each_options
Tables
- each_options
-
???
opt.file="./temp" -- match only this path
opt.file="./temp/" -- match all files in this path
This function do not expand filepath. So if we use "./*" mask and 'f' selector we get './some.file'.Fields:
- file string path and mask (default fs.currentdir() .. fs.DIR_SEP .. fs.ANY_MASK)
- param string - f fullpath and name - p path - n name - m mode - a attributes - z size - t atime - c ctime - l mtime (default "f")
- recurse boolean include subdirs (default false)
- reverse boolean direction of recursion - true subdirs at first - false subdirs at last - nil order undefined (default nil)
- delay boolean if true then iterate over snapshot of directory (default false)
- skipdirs boolean (default false)
- skipfiles boolean (default false)
- skipdots boolean (default true)