Provide relevant error message if datadir is not writable.

This commit is contained in:
murrayn
2018-03-07 03:08:55 -08:00
parent b225010a80
commit 8674e74b47
4 changed files with 33 additions and 0 deletions

View File

@@ -418,6 +418,19 @@ void ReleaseDirectoryLocks()
dir_locks.clear();
}
bool DirIsWritable(const fs::path& directory)
{
fs::path tmpFile = directory / fs::unique_path();
FILE* file = fsbridge::fopen(tmpFile, "a");
if (!file) return false;
fclose(file);
remove(tmpFile);
return true;
}
/** Interpret string as boolean, for argument parsing */
static bool InterpretBool(const std::string& strValue)
{