gz/common/Filesystem.hh
Go to the documentation of this file.
71 bool IGNITION_COMMON_VISIBLE createDirectories(const std::string &_path, std::ostream &_errorOut);
@ FSWO_SUPPRESS_WARNINGS
Errors that occur during filesystem manipulation should not be logged. The user will be responsible f...
Definition: gz/common/Filesystem.hh:43
Forward declarations for the common classes.
STL class.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
Microsoft Visual Studio does not automatically export the interface information for member variables ...
Definition: gz/common/SuppressWarning.hh:65
std::string uniqueDirectoryPath(const std::string &_dir)
Unique directory path to not overwrite existing directory.
std::string joinPaths(const std::string &_path1, const std::string &_path2)
Join two strings together to form a path.
bool moveFile(const std::string &_existingFilename, const std::string &_newFilename, const FilesystemWarningOp _warningOp=FSWO_LOG_WARNINGS)
Move a file.
std::string copyFromUnixPath(const std::string &_path)
Returns a copy of _path which has been passed through changeFromUnixPath.
const DirIter & operator++()
Pre-increment operator; moves to next directory record.
bool exists(const std::string &_path)
Determine whether the given path exists on the filesystem.
bool createDirectory(const std::string &_path)
Create a new directory on the filesystem. Intermediate directories must already exist.
std::string uniqueFilePath(const std::string &_pathAndName, const std::string &_extension)
Generates a path for a file which doesn't collide with existing files, by appending numbers to it (i....
@ FSWO_LOG_WARNINGS
Errors that occur during filesystem manipulation should be logged as warnings using ignwarn....
Definition: gz/common/Filesystem.hh:38
bool isDirectory(const std::string &_path)
Determine whether the given path is a directory.
bool removeFile(const std::string &_existingFilename, const FilesystemWarningOp _warningOp=FSWO_LOG_WARNINGS)
Remove a file.
bool operator!=(const DirIter &_other) const
Comparison operator to see if this iterator is at the same point as another iterator.
FilesystemWarningOp
Options for how to handle errors that occur in functions that manipulate the filesystem.
Definition: gz/common/Filesystem.hh:34
std::string absPath(const std::string &_path)
Get the absolute path of a provided path. Relative paths are resolved relative to the current working...
bool removeAll(const std::string &_path, const FilesystemWarningOp _warningOp=FSWO_LOG_WARNINGS)
Remove a file or a directory and all its contents.
STL class.
std::string parentPath(const std::string &_path)
Given a path, get just its parent path portion, without separator at the end.
void changeToUnixPath(std::string &_path)
Replace the preferred directory separator of the current operating system with a forward-slash '/'....
bool removeDirectoryOrFile(const std::string &_path, const FilesystemWarningOp _warningOp=FSWO_LOG_WARNINGS)
Remove an empty directory or file.
void changeFromUnixPath(std::string &_path)
Replace forward-slashes '/' with the preferred directory separator of the current operating system....
std::string basename(const std::string &_path)
Given a path, get just the basename portion.
bool copyDirectory(const std::string &_existingDirname, const std::string &_newDirname, const FilesystemWarningOp _warningOp=FSWO_LOG_WARNINGS)
Copy a directory, overwrite the destination directory if exists.
std::string operator*() const
Dereference operator; returns current directory record.
bool removeDirectory(const std::string &_path, const FilesystemWarningOp _warningOp=FSWO_LOG_WARNINGS)
Remove an empty directory.
std::string copyToUnixPath(const std::string &_path)
Returns a copy of _path which has been passed through changeToUnixPath.
bool createDirectories(const std::string &_path, std::ostream &_errorOut)
Create directories for the given path errors are printed to the given stream.
A class for iterating over all items in a directory.
Definition: gz/common/Filesystem.hh:268
bool copyFile(const std::string &_existingFilename, const std::string &_newFilename, const FilesystemWarningOp _warningOp=FSWO_LOG_WARNINGS)
Copy a file.
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
Definition: gz/common/SuppressWarning.hh:68
const std::string separator(std::string const &_s)
Append the preferred path separator character for this platform onto the passed-in string.