Module vlib.helpers.vFilesys

important - folders should end with a slash

Functions

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_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 print("vFilesys.get_parent_directory(file_path)",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 print("vFilesys.ensure_unique_filename(file_path)",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 print("vFilesys.sanitize_filename(filename)",filename)
generated by LDoc 1.4.2