Module ncine.fs

The table containing filesystem related functions

Functions

ncine.fs.join_path (first, second) Joins together two path components
ncine.fs.absolute_join_path (first, second) Returns the absolute path after joining together two path components
ncine.fs.dirname (path) Returns the path up to, but not including, the final separator
ncine.fs.basename (path) Returns the path component after the final separator
ncine.fs.absolute_path (path) Returns an absolute path from a relative one.
ncine.fs.get_extension (path) Returns the extension position in the string or nil if it is not found
ncine.fs.has_extension (path, extension) Returns true if the path has the specified extension (case-insensitive comparison)
ncine.fs.logical_drives () Returns a bitmask representing the currently available disk drives on Windows
ncine.fs.logical_drive_strings () Returns a buffer with strings that specify valid drives in the system on Windows
ncine.fs.get_current_dir () Returns the path of the current working directory
ncine.fs.set_current_dir (path) Sets the current working directory, the starting point for interpreting relative paths
ncine.fs.is_directory (path) Returns true if the specified path is a directory
ncine.fs.is_file (path) Returns true if the specified path is a file
ncine.fs.exists (path) Returns true if the file or directory exists
ncine.fs.is_readable (path) Returns true if the file or directory is readable
ncine.fs.is_writable (path) Returns true if the file or directory is writable
ncine.fs.is_executable (path) Returns true if the file or directory is executable
ncine.fs.is_readable_file (path) Returns true if the path is a file and is readable
ncine.fs.is_writable_file (path) Returns true if the path is a file and is writeable
ncine.fs.is_hidden (path) Returns true if the file or directory is hidden
ncine.fs.set_hidden (path, hidden) Makes a file or a directory hidden or not
ncine.fs.create_dir (path) Creates a new directory
ncine.fs.delete_empty_dir (path) Deletes an empty directory
ncine.fs.delete_file (path) Deletes a file
ncine.fs.rename (old_path, new_path) Renames or moves a file or a directory
ncine.fs.copy (old_path, new_path) Copies a file
ncine.fs.file_size (path) Returns the file size in bytes
ncine.fs.last_modification_time (path) Returns the last time the file or directory was modified
ncine.fs.last_access_time (path) Returns the last time the file or directory was accessed
ncine.fs.get_permissions (path) Returns the file or directory permissions in a mask
ncine.fs.change_permissions (path, mode) Returns the file or directory permissions in a mask
ncine.fs.add_permissions (path, mode) Adds the permissions in the mask to a file or a directory
ncine.fs.remove_permissions (path, mode) Removes the permissions in the mask from a file or a directory
ncine.fs.get_data_path () Returns the base directory for data loading
ncine.fs.get_home_path () Returns the current user home directory
ncine.fs.get_save_path () Returns the writable directory for saving data
ncine.fs.get_cache_path () Returns the writable directory for saving cache data

Tables

file_date A table with date information used for file modification or access time
ncine.permission File and directory permission modes (enumeration)


Functions

ncine.fs.join_path (first, second)
Joins together two path components

Parameters:

Returns:

    string
ncine.fs.absolute_join_path (first, second)
Returns the absolute path after joining together two path components

Parameters:

Returns:

    string
ncine.fs.dirname (path)
Returns the path up to, but not including, the final separator

Parameters:

Returns:

    string
ncine.fs.basename (path)
Returns the path component after the final separator

Parameters:

Returns:

    string
ncine.fs.absolute_path (path)
Returns an absolute path from a relative one.

It also resolves dot references to current and parent directories, and double separators.

Parameters:

Returns:

    string
ncine.fs.get_extension (path)
Returns the extension position in the string or nil if it is not found

Parameters:

Returns:

    string or nil
ncine.fs.has_extension (path, extension)
Returns true if the path has the specified extension (case-insensitive comparison)

Parameters:

Returns:

    boolean
ncine.fs.logical_drives ()
Returns a bitmask representing the currently available disk drives on Windows

Returns:

    integer
ncine.fs.logical_drive_strings ()
Returns a buffer with strings that specify valid drives in the system on Windows

Returns:

    string
ncine.fs.get_current_dir ()
Returns the path of the current working directory

Returns:

    string
ncine.fs.set_current_dir (path)
Sets the current working directory, the starting point for interpreting relative paths

Parameters:

Returns:

    boolean True if the directory has been successfully changed
ncine.fs.is_directory (path)
Returns true if the specified path is a directory

Parameters:

Returns:

    boolean
ncine.fs.is_file (path)
Returns true if the specified path is a file

Parameters:

Returns:

    boolean
ncine.fs.exists (path)
Returns true if the file or directory exists

Parameters:

Returns:

    boolean
ncine.fs.is_readable (path)
Returns true if the file or directory is readable

Parameters:

Returns:

    boolean
ncine.fs.is_writable (path)
Returns true if the file or directory is writable

Parameters:

Returns:

    boolean
ncine.fs.is_executable (path)
Returns true if the file or directory is executable

Parameters:

Returns:

    boolean
ncine.fs.is_readable_file (path)
Returns true if the path is a file and is readable

Parameters:

Returns:

    boolean
ncine.fs.is_writable_file (path)
Returns true if the path is a file and is writeable

Parameters:

Returns:

    boolean
ncine.fs.is_hidden (path)
Returns true if the file or directory is hidden

Parameters:

Returns:

    boolean
ncine.fs.set_hidden (path, hidden)
Makes a file or a directory hidden or not

Parameters:

Returns:

    boolean True if the new hidden state has been successfully set
ncine.fs.create_dir (path)
Creates a new directory

Parameters:

Returns:

    boolean True if the new directory has been created
ncine.fs.delete_empty_dir (path)
Deletes an empty directory

Parameters:

Returns:

    boolean True if the empty directory has been deleted
ncine.fs.delete_file (path)
Deletes a file

Parameters:

Returns:

    boolean True if the file has been deleted
ncine.fs.rename (old_path, new_path)
Renames or moves a file or a directory

Parameters:

Returns:

    boolean True if the file or directory has been renamed or moved
ncine.fs.copy (old_path, new_path)
Copies a file

Parameters:

Returns:

    boolean True if the file has been copied
ncine.fs.file_size (path)
Returns the file size in bytes

Parameters:

Returns:

    integer
ncine.fs.last_modification_time (path)
Returns the last time the file or directory was modified

Parameters:

Returns:

    file_date

See also:

ncine.fs.last_access_time (path)
Returns the last time the file or directory was accessed

Parameters:

Returns:

    file_date

See also:

ncine.fs.get_permissions (path)
Returns the file or directory permissions in a mask

Parameters:

Returns:

    integer A mask created from values in ncine.permission

See also:

ncine.fs.change_permissions (path, mode)
Returns the file or directory permissions in a mask

Parameters:

  • path string
  • mode integer A mask created from values in ncine.permission

Returns:

    boolean True if the permission mode was changed

See also:

ncine.fs.add_permissions (path, mode)
Adds the permissions in the mask to a file or a directory

Parameters:

  • path string
  • mode integer A mask created from values in ncine.permission

Returns:

    boolean True if the new permission mode was added

See also:

ncine.fs.remove_permissions (path, mode)
Removes the permissions in the mask from a file or a directory

Parameters:

  • path string
  • mode integer A mask created from values in ncine.permission

Returns:

    boolean True if the permission mode was removed

See also:

ncine.fs.get_data_path ()
Returns the base directory for data loading

Returns:

    string
ncine.fs.get_home_path ()
Returns the current user home directory

Returns:

    string
ncine.fs.get_save_path ()
Returns the writable directory for saving data

Returns:

    string
ncine.fs.get_cache_path ()
Returns the writable directory for saving cache data

Returns:

    string

Tables

file_date
A table with date information used for file modification or access time

Fields:

  • year integer
  • month integer
  • day integer
  • week_day integer
  • hour integer
  • minute integer
  • second integer
ncine.permission
File and directory permission modes (enumeration)

Fields:

  • READ
  • WRITE
  • EXECUTE
generated by LDoc 1.5.0 Last updated 2024-12-18 15:08:56