![]() |
TSDuck v3.43-4480
MPEG Transport Stream Toolkit
|
File system and file path features (in addition to std::filesystem). More...

Classes | |
| class | ts::FileNameGenerator |
| Generate file names based on counter or dates and time. More... | |
| class | ts::PolledFile |
| Description of a polled file. More... | |
| class | ts::PollFiles |
| A class to poll files for modifications. More... | |
| class | ts::PollFilesListener |
| Interface for classes listening for file modification. More... | |
Functions | |
| UString | ts::AbsoluteFilePath (const UString &path, const UString &base=UString()) |
| Build the absolute form of a file path. | |
| UString | ts::BaseName (const UString &path, const UString &suffix=UString()) |
| Return the base file name of a file path ("dir/foo.bar" => "foo.bar"). | |
| UString | ts::CleanupFilePath (const UString &path) |
| Cleanup a file path. | |
| UString | ts::DirectoryName (const UString &path) |
| Return the directory name of a file path ("dir/foo.bar" => "dir"). | |
| template<class CONTAINER > | |
| bool | ts::ExpandWildcard (CONTAINER &container, const UString &pattern) |
| Get all files matching a specified wildcard pattern. | |
| template<class CONTAINER > | |
| bool | ts::ExpandWildcardAndAppend (CONTAINER &container, const UString &pattern) |
| Get all files matching a specified wildcard pattern and append them into a container. | |
| Time | ts::GetFileModificationTimeLocal (const UString &path) |
| Get the local time of the last modification of a file. | |
| Time | ts::GetFileModificationTimeUTC (const UString &path) |
| Get the UTC time of the last modification of a file. | |
| bool | ts::IsAbsoluteFilePath (const UString &path) |
| Check if a file path is absolute (starting at a root of a file system). | |
| UString | ts::RelativeFilePath (const UString &path, const UString &base=UString(), CaseSensitivity caseSensitivity=FILE_SYSTEM_CASE_SENSITVITY, bool portableSlashes=false) |
| Build a relative form of a file path, relative to a base directory. | |
| UString | ts::SearchConfigurationFile (const UString &fileName) |
| Search a configuration file. | |
| UString | ts::SearchExecutableFile (const UString &fileName, const UString &pathName=PATH_ENVIRONMENT_VARIABLE) |
| Search an executable file. | |
| template<class CONTAINER > | |
| bool | ts::SearchWildcard (CONTAINER &container, const UString &root, const UString &pattern, size_t max_levels=64, bool skip_symlinks=true) |
| Search all files matching a specified wildcard pattern in a directory tree. | |
| template<class CONTAINER > | |
| bool | ts::SearchWildcardAndAppend (CONTAINER &container, const UString &root, const UString &pattern, size_t max_levels=64, bool skip_symlinks=true) |
| Search all files matching a specified wildcard pattern in a directory tree and append them into a container. | |
| fs::path | ts::TempFile (const UString &suffix=u".tmp") |
| Return the name of a unique temporary file. | |
| UString | ts::UserConfigurationFileName (const UString &fileName, const UString &winFileName=UString()) |
| Build the name of a user-specific configuration file. | |
| fs::path | ts::UserHomeDirectory () |
| Get the current user's home directory. | |
| UString | ts::VernacularFilePath (const UString &path) |
| Return a "vernacular" version of a file path. | |
Variables | |
| constexpr const UChar * | ts::DEFAULT_CSV_SEPARATOR = u"," |
| Default separator in CSV (comma-separated values) format. | |
| constexpr const UChar * | ts::EXECUTABLE_FILE_SUFFIX = platform - specific(".exe", "") |
| Executable file suffix. | |
| constexpr CaseSensitivity | ts::FILE_SYSTEM_CASE_SENSITVITY = platform-specific |
| Case-sensitivity of the names in the file system. | |
| constexpr const UChar * | ts::SHARED_LIBRARY_SUFFIX = platform - specific(".dll", ".so", ".dylib") |
| File name extension of shared library file names (".so" on Linux, '.dylib" on macOS, ".dll" on Windows). | |
File system and file path features (in addition to std::filesystem).
Return a "vernacular" version of a file path.
| [in] | path | A file path. |
| bool ts::IsAbsoluteFilePath | ( | const UString & | path | ) |
Check if a file path is absolute (starting at a root of a file system).
| [in] | path | A file path. |
Build the absolute form of a file path.
| [in] | path | A file path. |
| [in] | base | The base directory to use if path is a relative file path. By default, when base is empty, the current working directory is used. |
| UString ts::RelativeFilePath | ( | const UString & | path, |
| const UString & | base = UString(), |
||
| CaseSensitivity | caseSensitivity = FILE_SYSTEM_CASE_SENSITVITY, |
||
| bool | portableSlashes = false |
||
| ) |
Build a relative form of a file path, relative to a base directory.
| [in] | path | A file path. |
| [in] | base | The base directory to use. By default, when base is empty, the current working directory is used. |
| [in] | caseSensitivity | Case sensitivity of file names comparison. By default, use the local file system case sensitivity. |
| [in] | portableSlashes | If true, the relative path contains forward slashes ('/'), even on Windows. The resulting path can be used in relative URL's for instance. |
Cleanup a file path.
| [in] | path | A file path. |
Return the directory name of a file path ("dir/foo.bar" => "dir").
| [in] | path | A file path. |
Return the base file name of a file path ("dir/foo.bar" => "foo.bar").
| [in] | path | A file path. |
| [in] | suffix | An optional file suffix. If path ends in suffix, the suffix is removed. |
| fs::path ts::UserHomeDirectory | ( | ) |
Get the current user's home directory.
| ts::Exception | In case of operating system error. |
| fs::path ts::TempFile | ( | const UString & | suffix = u".tmp" | ) |
Return the name of a unique temporary file.
| [in] | suffix | An optional suffix to add to the file name. |
Get the local time of the last modification of a file.
| [in] | path | A file path. |
Get the UTC time of the last modification of a file.
| [in] | path | A file path. |
| bool ts::ExpandWildcardAndAppend | ( | CONTAINER & | container, |
| const UString & | pattern | ||
| ) |
Get all files matching a specified wildcard pattern and append them into a container.
| CONTAINER | A container class of UString as defined by the C++ Standard Template Library (STL). |
| [in,out] | container | A container of UString receiving the the names of all files matching the wildcard. The names are appended at the end of the existing content of the container. |
| [in] | pattern | A file path pattern with wildcards. The syntax of the wildcards is system-dependent. |
|
inline |
Get all files matching a specified wildcard pattern.
| CONTAINER | A container class of UString as defined by the C++ Standard Template Library (STL). |
| [out] | container | A container of UString receiving the the names of all files matching the wildcard. |
| [in] | pattern | A file path pattern with wildcards. The syntax of the wildcards is system-dependent. |
| bool ts::SearchWildcardAndAppend | ( | CONTAINER & | container, |
| const UString & | root, | ||
| const UString & | pattern, | ||
| size_t | max_levels = 64, |
||
| bool | skip_symlinks = true |
||
| ) |
Search all files matching a specified wildcard pattern in a directory tree and append them into a container.
| CONTAINER | A container class of UString as defined by the C++ Standard Template Library (STL). |
| [in,out] | container | A container of UString receiving the the names of all files matching the wildcard. The names are appended at the end of the existing content of the container. |
| [in] | root | Root directory into which the files are searched. |
| [in] | pattern | A file path pattern with wildcards. The syntax of the wildcards is system-dependent. |
| [in] | max_levels | Maximum number of directory recursions. Since some operating systems allow loops in the file system, it is a good idea to set some limit to avoid infinite recursion. |
| [in] | skip_symlinks | If true, do not recurse through symbolic links to directories. |
|
inline |
Search all files matching a specified wildcard pattern in a directory tree.
| CONTAINER | A container class of UString as defined by the C++ Standard Template Library (STL). |
| [out] | container | A container of UString receiving the the names of all files matching the wildcard. |
| [in] | root | Root directory into which the files are searched. |
| [in] | pattern | A file path pattern with wildcards. The syntax of the wildcards is system-dependent. |
| [in] | max_levels | Maximum number of directory recursions. Since some operating systems allow loops in the file system, it is a good idea to set some limit to avoid infinite recursion. |
| [in] | skip_symlinks | If true, do not recurse through symbolic links to directories. |
| UString ts::SearchExecutableFile | ( | const UString & | fileName, |
| const UString & | pathName = PATH_ENVIRONMENT_VARIABLE |
||
| ) |
Search an executable file.
| [in] | fileName | Name of the file to search. |
| [in] | pathName | Name of the seach path environment variable. |
Search a configuration file.
| [in] | fileName | Name of the file to search. If fileName is not found and does not contain any directory part, search this file in the following places:
|
| UString ts::UserConfigurationFileName | ( | const UString & | fileName, |
| const UString & | winFileName = UString() |
||
| ) |
Build the name of a user-specific configuration file.
| [in] | fileName | Base name of the configuration file. |
| [in] | winFileName | Alternative base name on Windows. If empty, fileName is used. |
%APPDATA%\tsduck $HOME
|
constexpr |
Default separator in CSV (comma-separated values) format.
CSV files are suitable for analysis using tools such as Microsoft Excel.