common/file_util: Fix and deprecate CreateFullPath, add CreateDirs
Fix CreateFullPath to have its intended previous behavior (whatever that was), and deprecate it in favor of the new CreateDirs function. Unlike CreateDir, CreateDirs is marked as [[nodiscard]] to avoid new code ignoring its result value.
This commit is contained in:
parent
52f13f2339
commit
5329834376
2 changed files with 31 additions and 4 deletions
|
@ -54,8 +54,14 @@ enum class UserPath {
|
|||
// Returns true if successful, or path already exists.
|
||||
bool CreateDir(const std::filesystem::path& path);
|
||||
|
||||
// Creates the full path of path. Returns true on success
|
||||
bool CreateFullPath(const std::filesystem::path& path);
|
||||
// Create all directories in path
|
||||
// Returns true if successful, or path already exists.
|
||||
[[nodiscard("Directory creation can fail and must be tested")]] bool CreateDirs(
|
||||
const std::filesystem::path& path);
|
||||
|
||||
// Creates directories in path. Returns true on success.
|
||||
[[deprecated("This function is deprecated, use CreateDirs")]] bool CreateFullPath(
|
||||
const std::filesystem::path& path);
|
||||
|
||||
// Deletes a given file at the path.
|
||||
// This will also delete empty directories.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue