TSDuck Version 3.32-2775 (TSDuck - The MPEG Transport Stream Toolkit)
tsFileUtils.h File Reference

File utilities (file path, file properties, etc). More...

Classes

struct  ts::EnableBitMaskOperators< ts::ResolveSymbolicLinksFlags >
 Template specialization on type ts::ResolveSymbolicLinksFlags
More...
 

Namespaces

 ts
 TSDuck namespace, containing all TSDuck classes and functions.
 

Macros

#define TS_COMMAND_PATH   platform-specific ("PATH", "Path")
 Environment variable containing the command search path.
 
#define TS_EXECUTABLE_SUFFIX   platform-specific (".exe", "")
 Executable file suffix.
 
#define TS_PLUGINS_PATH   u"TSPLUGINS_PATH"
 Name of the environment variable which contains a list of paths for plugins.
 
#define TS_SHARED_LIB_SUFFIX   platform-specific (".dll", ".so", ".dylib")
 File name extension of shared library file names (".so" on Linux, '.dylib" on macOS, ".dll" on Windows).
 

Enumerations

enum  ts::ResolveSymbolicLinksFlags {
  ts::LINK_SINGLE = 0x0000,
  ts::LINK_RECURSE = 0x0001,
  ts::LINK_ABSOLUTE = 0x0002
}
 Flags for ResolveSymbolicLinks(). More...
 

Functions

UString ts::AbsoluteFilePath (const UString &path, const UString &base=UString())
 Build the absolute form of a file path. More...
 
UString ts::AddPathSuffix (const UString &path, const UString &suffix)
 Conditionally add a suffix to a file path. More...
 
UString ts::BaseName (const UString &path, const UString &suffix=UString())
 Return the base file name of a file path ("dir/foo.bar" => "foo.bar"). More...
 
UString ts::CleanupFilePath (const UString &path)
 Cleanup a file path. More...
 
bool ts::CreateDirectory (const UString &path, bool intermediate=false, Report &report=(*(static_cast< ts::Report * >(ts::CerrReport::Instance()))))
 Create a directory. More...
 
UString ts::CurrentWorkingDirectory ()
 Get the current working directory. More...
 
bool ts::DeleteFile (const UString &path, Report &report=(*(static_cast< ts::Report * >(ts::CerrReport::Instance()))))
 Delete a file or directory. More...
 
UString ts::DirectoryName (const UString &path)
 Return the directory name of a file path ("dir/foo.bar" => "dir"). More...
 
template<class CONTAINER >
bool ts::ExpandWildcard (CONTAINER &container, const UString &pattern)
 Get all files matching a specified wildcard pattern. More...
 
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. More...
 
bool ts::FileExists (const UString &path)
 Check if a file or directory exists. More...
 
Time ts::GetFileModificationTimeLocal (const UString &path)
 Get the local time of the last modification of a file. More...
 
Time ts::GetFileModificationTimeUTC (const UString &path)
 Get the UTC time of the last modification of a file. More...
 
int64_t ts::GetFileSize (const UString &path)
 Get the size in bytes of a file. More...
 
bool ts::IsAbsoluteFilePath (const UString &path)
 Check if a file path is absolute (starting at a root of a file system). More...
 
bool ts::IsDirectory (const UString &path)
 Check if a path exists and is a directory. More...
 
bool ts::IsSymbolicLink (const UString &path)
 Check if a file path is a symbolic link. More...
 
UString ts::PathPrefix (const UString &path)
 Return the prefix of a file path ("dir/foo.bar" => "dir/foo"). More...
 
UString ts::PathSuffix (const UString &path)
 Return the suffix of a file path ("dir/foo.bar" => ".bar"). More...
 
UString ts::RelativeFilePath (const UString &path, const UString &base=UString(), CaseSensitivity caseSensitivity=FileSystemCaseSensitivity, bool portableSlashes=false)
 Build a relative form of a file path, relative to a base directory. More...
 
bool ts::RenameFile (const UString &old_path, const UString &new_path, Report &report=(*(static_cast< ts::Report * >(ts::CerrReport::Instance()))))
 Rename / move a file or directory. More...
 
UString ts::ResolveSymbolicLinks (const UString &path, ResolveSymbolicLinksFlags flags=LINK_SINGLE)
 Resolve symbolic links. More...
 
UString ts::SearchConfigurationFile (const UString &fileName)
 Search a configuration file. More...
 
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. More...
 
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. More...
 
UString ts::TempDirectory ()
 Return the name of a directory for temporary files. More...
 
UString ts::TempFile (const UString &suffix=u".tmp")
 Return the name of a unique temporary file. More...
 
bool ts::TruncateFile (const UString &path, uint64_t size, Report &report=(*(static_cast< ts::Report * >(ts::CerrReport::Instance()))))
 Truncate a file to the specified size. More...
 
UString ts::UserConfigurationFileName (const UString &fileName, const UString &winFileName=UString())
 Build the name of a user-specific configuration file. More...
 
UString ts::UserHomeDirectory ()
 Get the current user's home directory. More...
 
UString ts::VernacularFilePath (const UString &path)
 Return a "vernacular" version of a file path. More...
 

Variables

const CaseSensitivity ts::FileSystemCaseSensitivity = platform-specific
 Case-sensitivity of the names in the file system.
 
const UChar ts::PathSeparator = platform-specific ('/', '\\')
 Directory separator character in file paths.
 

Detailed Description

File utilities (file path, file properties, etc).