|
Easy3D 2.6.1
|
A very basic filesystem implementation. More...
Functions | |
| bool | is_file (const std::string &path) |
| Tests if 'path' is an existing file. | |
| bool | is_directory (const std::string &path) |
| Tests if 'path' is an existing directory. | |
| bool | create_directory (const std::string &path) |
| Creates a directory entitled 'path'. | |
| bool | delete_file (const std::string &path) |
| Deletes the file 'path'. | |
| bool | delete_directory (const std::string &path) |
| Deletes the directory 'path' (and its contents will be deleted recursively). | |
| bool | delete_contents (const std::string &path) |
| Deletes the contents of the directory 'path' (the directory will not be deleted). | |
| void | get_directory_entries (const std::string &path, std::vector< std::string > &entries, bool recursive) |
| Queries the entries of a directory (including subdirectories and files). | |
| void | get_files (const std::string &path, std::vector< std::string > &files, bool recursive) |
| Queries file entries of a directory 'path'. | |
| void | get_sub_directories (const std::string &path, std::vector< std::string > &subs, bool recursive) |
| Query subdirectory entries of a directory 'path'. | |
| std::string | current_working_directory () |
| Query the current working directory. | |
| bool | set_current_working_directory (const std::string &path) |
| Set the current working directory. | |
| std::string | home_directory () |
| Query the home path for the current user. | |
| std::string | executable () |
| Query the name of this executable. | |
| std::string | executable_directory () |
| Query the directory where the executable file is located. | |
| bool | rename_file (const std::string &old_name, const std::string &new_name) |
| Rename the file from 'old_name' to 'new_name'. | |
| time_t | time_stamp (const std::string &path) |
| Query the time stamp of a file or directory. | |
| std::string | time_string (const std::string &path) |
| Query the time stamp of a file or directory as a string. | |
| std::ifstream::pos_type | file_size (const std::string &path) |
| Query the size of the file. | |
| std::string | parent_directory (const std::string &path) |
| Query the parent path from full name of a file or directory (e.g., /a/b/c.Ext => /a/b) | |
| std::string | extension (const std::string &path, bool lower=true) |
| Query the file extension without dot (e.g., /a/b/c.Ext => Ext). | |
| std::string | simple_name (const std::string &path) |
| Gets file name without path but with extension (e.g, /a/b/c.Ext => c.Ext) | |
| std::string | base_name (const std::string &path) |
| Gets file name without path and last extension (e.g., c:/file.ext1.ext2 => file.ext1; /a/b/c.Ext => c). | |
| std::string | name_less_extension (const std::string &path) |
| Gets file path without last extension (e.g., /a/b/c.Ext => /a/b/c; file.ext1.ext2 => file.ext1). | |
| std::string | name_less_all_extensions (const std::string &path) |
| Gets file path without all extensions (e.g., /a/b/c.Ext => /a/b/c; file.ext1.ext2 => file). | |
| std::string | replace_extension (std::string const &path, const std::string &ext) |
| Replaces the extension of the given file with 'ext'. If the file name does not have an extension, the expected new extension is appended. | |
| std::string | path_root (const std::string &path) |
| Gets root part of a path ("/" or "C:"), or an empty string if none found. | |
| bool | is_absolute_path (const std::string &path) |
| Tests if path is absolute, as !get_path_root(path).empty(). . | |
| std::string | relative_path (const std::string &from, const std::string &to) |
| Compute the relative path from 'from' to 'to'. | |
| std::string | absolute_path (const std::string &path) |
| Converts to absolute path (i.e., removes .. and . from a path string). | |
| std::string | convert_to_windows_style (const std::string &path) |
| Converts the path to Windows style, i.e., forward slashes (/) to back slashes (\). | |
| std::string | convert_to_unix_style (const std::string &path) |
| Converts the path to Unix style, i.e., back slashes (\) to forward slashes (/). | |
| std::string | convert_to_native_style (const std::string &path) |
| Convert a path string such that it uses the current platform's path separators. | |
| char | native_path_separator () |
| Gets the path separator of the current platform. | |
| bool | is_native_style (const std::string &path) |
| Checks sif the path contains only the current platform's path separators. | |
| bool | copy_file (const std::string &original, const std::string ©) |
| Makes a copy of an existing file. | |
| bool | file_contains_string (const std::string &filename, const std::string &str) |
| Checks if a file contains string 'str'. | |
| void | read_file_to_string (const std::string &filename, std::string &str) |
| Reads the contents of a file into a string. | |
| void | write_string_to_file (const std::string &str, const std::string &filename) |
| Writes the string into a file. | |
A very basic filesystem implementation.
| std::string absolute_path | ( | const std::string & | path | ) |
Converts to absolute path (i.e., removes .. and . from a path string).
| path | The path string. |
| std::string base_name | ( | const std::string & | path | ) |
Gets file name without path and last extension (e.g., c:/file.ext1.ext2 => file.ext1; /a/b/c.Ext => c).
| path | The full path of a file. |
| std::string convert_to_native_style | ( | const std::string & | path | ) |
Convert a path string such that it uses the current platform's path separators.
| path | The path string. |
| std::string convert_to_unix_style | ( | const std::string & | path | ) |
Converts the path to Unix style, i.e., back slashes (\) to forward slashes (/).
| path | The path string. |
| std::string convert_to_windows_style | ( | const std::string & | path | ) |
Converts the path to Windows style, i.e., forward slashes (/) to back slashes (\).
| path | The path string. |
| bool copy_file | ( | const std::string & | original, |
| const std::string & | copy ) |
Makes a copy of an existing file.
| original | The file name of the original file. |
| copy | The file name of the copy |
| bool create_directory | ( | const std::string & | path | ) |
Creates a directory entitled 'path'.
| path | The full path of the directory to be created. |
| std::string current_working_directory | ( | ) |
Query the current working directory.
| bool delete_contents | ( | const std::string & | path | ) |
Deletes the contents of the directory 'path' (the directory will not be deleted).
| path | The full path of a directory. |
| bool delete_directory | ( | const std::string & | path | ) |
Deletes the directory 'path' (and its contents will be deleted recursively).
| path | The full path of a directory. |
| bool delete_file | ( | const std::string & | path | ) |
Deletes the file 'path'.
| path | The full path of a file. |
| std::string executable | ( | ) |
Query the name of this executable.
| std::string executable_directory | ( | ) |
Query the directory where the executable file is located.
| std::string extension | ( | const std::string & | path, |
| bool | lower = true ) |
Query the file extension without dot (e.g., /a/b/c.Ext => Ext).
| path | The full path of a file. |
| lower | Converts the string to lower case if true. |
| bool file_contains_string | ( | const std::string & | filename, |
| const std::string & | str ) |
Checks if a file contains string 'str'.
| filename | The string of the file name. |
| str | The string to be checked. |
| std::ifstream::pos_type file_size | ( | const std::string & | path | ) |
Query the size of the file.
| path | The full path of the file. |
| void get_directory_entries | ( | const std::string & | path, |
| std::vector< std::string > & | entries, | ||
| bool | recursive ) |
Queries the entries of a directory (including subdirectories and files).
| path | The full path of a directory. |
| entries | Return the entries of the directory. Result strings are simple names (i.e., without the path part, e.g., cat.png). |
| recursive | Performs the query recursively if true. |
| void get_files | ( | const std::string & | path, |
| std::vector< std::string > & | files, | ||
| bool | recursive ) |
Queries file entries of a directory 'path'.
| path | The full path of a directory. |
| files | Return the file entries of 'path'. Result strings are simple names (i.e., without the 'path' part, e.g., cat.png). |
| recursive | Perform the query recursively if true. |
| void get_sub_directories | ( | const std::string & | path, |
| std::vector< std::string > & | subs, | ||
| bool | recursive ) |
Query subdirectory entries of a directory 'path'.
| path | The full path of a directory. |
| subs | Return the subdirectory entries of 'path'. Result strings are only the names of the subdirectories (i.e., without the 'path' part). |
| recursive | Perform the query recursively if true. |
| std::string home_directory | ( | ) |
Query the home path for the current user.
| bool is_absolute_path | ( | const std::string & | path | ) |
Tests if path is absolute, as !get_path_root(path).empty(). .
| path | The path. |
| bool is_directory | ( | const std::string & | path | ) |
Tests if 'path' is an existing directory.
| path | The full path of a directory. |
| bool is_file | ( | const std::string & | path | ) |
Tests if 'path' is an existing file.
| path | The full path of a file (including file extension). |
| bool is_native_style | ( | const std::string & | path | ) |
Checks sif the path contains only the current platform's path separators.
| std::string name_less_all_extensions | ( | const std::string & | path | ) |
Gets file path without all extensions (e.g., /a/b/c.Ext => /a/b/c; file.ext1.ext2 => file).
| path | The full path of a file. |
| std::string name_less_extension | ( | const std::string & | path | ) |
Gets file path without last extension (e.g., /a/b/c.Ext => /a/b/c; file.ext1.ext2 => file.ext1).
| path | The full path of a file. |
| char native_path_separator | ( | ) |
Gets the path separator of the current platform.
| std::string parent_directory | ( | const std::string & | path | ) |
Query the parent path from full name of a file or directory (e.g., /a/b/c.Ext => /a/b)
| path | The full path of the file or directory. |
| std::string path_root | ( | const std::string & | path | ) |
Gets root part of a path ("/" or "C:"), or an empty string if none found.
| path | The path. |
| void read_file_to_string | ( | const std::string & | filename, |
| std::string & | str ) |
Reads the contents of a file into a string.
| filename | The string of the file name. |
| str | The destination string. |
| std::string relative_path | ( | const std::string & | from, |
| const std::string & | to ) |
Compute the relative path from 'from' to 'to'.
| from | The 'from' directory. |
| to | The 'to' directory. |
| bool rename_file | ( | const std::string & | old_name, |
| const std::string & | new_name ) |
Rename the file from 'old_name' to 'new_name'.
| old_name | The full path of the file to be renamed. |
| new_name | The full path of the file's new name. |
| std::string replace_extension | ( | std::string const & | path, |
| const std::string & | ext ) |
Replaces the extension of the given file with 'ext'. If the file name does not have an extension, the expected new extension is appended.
| path | The file name. |
| ext | The expected new extension. |
| bool set_current_working_directory | ( | const std::string & | path | ) |
Set the current working directory.
| path | The string representing the new current working directory. |
| std::string simple_name | ( | const std::string & | path | ) |
Gets file name without path but with extension (e.g, /a/b/c.Ext => c.Ext)
| path | The full path of a file. |
| time_t time_stamp | ( | const std::string & | path | ) |
Query the time stamp of a file or directory.
| path | The full path of the file or directory. |
| std::string time_string | ( | const std::string & | path | ) |
Query the time stamp of a file or directory as a string.
| path | The full path of the file or directory. |
| void write_string_to_file | ( | const std::string & | str, |
| const std::string & | filename ) |
Writes the string into a file.
| str | The string. |
| filename | The string of the file name. |