mirror of https://github.com/PCSX2/pcsx2.git
Common/FileSystem: Add EnsureDirectoryExists()
This commit is contained in:
parent
d6f1291c0b
commit
ed9f34de5f
|
@ -565,6 +565,15 @@ bool FileSystem::WriteFileToString(const char* filename, const std::string_view&
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FileSystem::EnsureDirectoryExists(const char* path, bool recursive)
|
||||
{
|
||||
if (FileSystem::DirectoryExists(path))
|
||||
return true;
|
||||
|
||||
// if it fails to create, we're not going to be able to use it anyway
|
||||
return FileSystem::CreateDirectoryPath(path, recursive);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
static u32 TranslateWin32Attributes(u32 Win32Attributes)
|
||||
|
|
|
@ -150,6 +150,10 @@ namespace FileSystem
|
|||
/// if they do not exist.
|
||||
bool CreateDirectoryPath(const char* path, bool recursive);
|
||||
|
||||
/// Creates a directory if it doesn't already exist.
|
||||
/// Returns false if it does not exist and creation failed.
|
||||
bool EnsureDirectoryExists(const char* path, bool recursive);
|
||||
|
||||
/// Returns the path to the current executable.
|
||||
std::string GetProgramPath();
|
||||
|
||||
|
|
Loading…
Reference in New Issue