Updated error handling

This commit is contained in:
Uwe Seimet 2021-12-20 19:37:32 +01:00
parent 66c380bd97
commit 362a90f3dc

View File

@ -59,6 +59,9 @@ bool RascsiImage::CreateImageFolder(int fd, const string& filename)
if (filename_start != string::npos) {
string folder = filename.substr(0, filename_start);
// Checking for existence first prevents an error if the top-level folder is a softlink
struct stat st;
if (stat(folder.c_str(), &st)) {
std::error_code error;
filesystem::create_directories(folder, error);
if (error) {
@ -66,6 +69,7 @@ bool RascsiImage::CreateImageFolder(int fd, const string& filename)
return false;
}
}
}
return true;
}