mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-18 04:45:39 +00:00
Added a function to delete directories.
This commit is contained in:
parent
7ab7dcc7c6
commit
c63fc39e8d
|
@ -676,6 +676,25 @@ namespace Utils
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool removeDirectory(const std::string& path)
|
||||||
|
{
|
||||||
|
if (getDirContent(path).size() != 0) {
|
||||||
|
LOG(LogError) << "Couldn't delete directory as it's not empty";
|
||||||
|
LOG(LogError) << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#if defined(_WIN64)
|
||||||
|
if (_wrmdir(Utils::String::stringToWideString(path).c_str()) == 0) {
|
||||||
|
#else
|
||||||
|
if (rmdir(path.c_str()) != 0) {
|
||||||
|
#endif
|
||||||
|
LOG(LogError) << "Couldn't delete directory, permission problems?";
|
||||||
|
LOG(LogError) << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool createDirectory(const std::string& _path)
|
bool createDirectory(const std::string& _path)
|
||||||
{
|
{
|
||||||
std::string path = getGenericPath(_path);
|
std::string path = getGenericPath(_path);
|
||||||
|
|
|
@ -53,6 +53,7 @@ namespace Utils
|
||||||
bool renameFile(const std::string& _source_path,
|
bool renameFile(const std::string& _source_path,
|
||||||
const std::string& _destination_path, bool _overwrite);
|
const std::string& _destination_path, bool _overwrite);
|
||||||
bool removeFile(const std::string& _path);
|
bool removeFile(const std::string& _path);
|
||||||
|
bool removeDirectory(const std::string& path);
|
||||||
|
|
||||||
bool createDirectory(const std::string& _path);
|
bool createDirectory(const std::string& _path);
|
||||||
bool exists(const std::string& _path);
|
bool exists(const std::string& _path);
|
||||||
|
|
Loading…
Reference in a new issue