Module classes.helpers.vFilesys

Static methods for dealing with the file-system

Functions

get_path_parts (file_path) important - folders should end with a slash
get_parent_directory (file_path) provided with a string, this method will find the parent folder (using file system functions, so the location is guaranteed to exist)
ensure_unique_filename (file_path) if file already exist, return a name with (number) appended to it
get_directories (file_path) split path into parts, seperated by slashes
validate_filename (str) make sure a file/folder name does not contain anything considered bad return bool
sanitize_filename (filename) remove illegal characters


Functions

get_path_parts (file_path)
important - folders should end with a slash

Parameters:

  • file_path

Returns:

  1. string, folder
  2. string, filename
  3. string, extension
get_parent_directory (file_path)
provided with a string, this method will find the parent folder (using file system functions, so the location is guaranteed to exist)

Parameters:

  • file_path

Returns:

  1. string or nil if failed
  2. int, error code
ensure_unique_filename (file_path)
if file already exist, return a name with (number) appended to it

Parameters:

  • file_path
get_directories (file_path)
split path into parts, seperated by slashes

Parameters:

  • file_path

Returns:

    table>string
validate_filename (str)
make sure a file/folder name does not contain anything considered bad return bool

Parameters:

  • str
sanitize_filename (filename)
remove illegal characters

Parameters:

  • filename
generated by LDoc 1.4.2