mirror of https://github.com/oxen-io/oxen-core.git
Check before trying to create directory
How this was written was fine if the data directory is an actual directory, but it could fail if it was a symlink to a directory. This commit adds an extra check for fs::is_directory() which works through the symlink and thus avoids trying to create (and failing) in such a case.
This commit is contained in:
parent
de7bad36c0
commit
1abd5e5547
|
@ -619,8 +619,7 @@ namespace cryptonote
|
|||
folder /= "fake";
|
||||
|
||||
// make sure the data directory exists, and try to lock it
|
||||
|
||||
if (std::error_code ec; !fs::create_directories(folder, ec) && ec)
|
||||
if (std::error_code ec; !fs::is_directory(folder, ec) && !fs::create_directories(folder, ec) && ec)
|
||||
{
|
||||
MERROR("Failed to create directory " + folder.u8string() + (ec ? ": " + ec.message() : ""s));
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue