|
libxcks
0.1.0.1
|
Path utilities. More...
#include <utf8cpp/utf8.h>#include <algorithm>#include <iterator>#include <cstdio>#include "pathutil.hpp"#include "strutil.hpp"
Go to the source code of this file.
Functions | |
| std::vector< std::filesystem::path > | libxcks::getDirectories (const std::filesystem::path &p) |
| Gets directories of a path. More... | |
| ArrayString | libxcks::getDirectoriesAsArrayString (const std::filesystem::path &p) |
| Gets directories of a path. More... | |
| int | libxcks::compareFileName (const std::string &fn1, const std::string &fn2) |
| Compares two file names. More... | |
| int | libxcks::compareFileName (const std::filesystem::path &p1, const std::filesystem::path &p2) |
| Compares file names of two paths. More... | |
| std::filesystem::path | libxcks::constructPath (const ArrayString &dirs, const std::string &filename) |
| Constructs a path from an array of directories and an optional filename. More... | |
| std::filesystem::path | libxcks::ensureEndsWithPathSeparator (const std::filesystem::path &p) |
| Ensures the path ends with a path separator. More... | |
| bool | libxcks::isFileNameValid (const std::string &filename) |
| Checks if the name of the file is valid. More... | |
Path utilities.
Definition in file pathutil.cpp.
| int libxcks::compareFileName | ( | const std::filesystem::path & | p1, |
| const std::filesystem::path & | p2 | ||
| ) |
Compares file names of two paths.
Under Windows the comparison is case insensitive.
| p1 | First path. |
| p2 | Second path. |
f1 < f2, a positive value if f1 > f2, 0 if f1 == f2. Definition at line 137 of file pathutil.cpp.
| int libxcks::compareFileName | ( | const std::string & | fn1, |
| const std::string & | fn2 | ||
| ) |
Compares two file names.
Under Windows the comparison is case insensitive.
| fn1 | First file name. |
| fn2 | Second file name. |
f1 < f2, a positive value if f1 > f2, 0 if f1 == f2. Definition at line 108 of file pathutil.cpp.
| std::filesystem::path libxcks::constructPath | ( | const ArrayString & | dirs, |
| const std::string & | filename | ||
| ) |
Constructs a path from an array of directories and an optional filename.
| [in] | dirs | The array of directories. |
| [in] | filename | The filename. Can be empty. |
Definition at line 170 of file pathutil.cpp.
| std::filesystem::path libxcks::ensureEndsWithPathSeparator | ( | const std::filesystem::path & | p | ) |
Ensures the path ends with a path separator.
| [in] | p | The path to ensure it ends with a path separator. |
Definition at line 209 of file pathutil.cpp.
| std::vector< std::filesystem::path > libxcks::getDirectories | ( | const std::filesystem::path & | p | ) |
Gets directories of a path.
| [in] | p | The path the directories are wanted. |
Definition at line 64 of file pathutil.cpp.
| ArrayString libxcks::getDirectoriesAsArrayString | ( | const std::filesystem::path & | p | ) |
Gets directories of a path.
| [in] | p | The path the directories are wanted. |
Definition at line 81 of file pathutil.cpp.
| bool libxcks::isFileNameValid | ( | const std::string & | filename | ) |
Checks if the name of the file is valid.
The name of the file to check must be a full name (including extension but excluding directories).
The forbidden characters are:
/ (forward slash) and NUL byte.< (less than)> (greater than): (colon)" (double quote)/ (forward slash)\ (backslash)| (vertical bar or pipe)? (question mark)* (asterisk)NUL byte/ (forward slash), : (colon) and NUL byte (even if this one is officially supported).On Windows the following is also considered as invalid:
CON, PRN, AUX, NULCOM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8 and COM9LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8 and LPT9An empty name is invalid.
The full names . and .. are also invalid on Unix and Windows.
| filename | The name of file to check (see upper). |
true if the name of file is valid on the current OS, false otherwise. Definition at line 266 of file pathutil.cpp.