mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 11:44:14 +01:00
Provide relevant error message if datadir is not writable.
This commit is contained in:
13
src/util.cpp
13
src/util.cpp
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user