mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
error if settings.json exists, but is unreadable
This commit is contained in:
@ -60,9 +60,15 @@ bool ReadSettings(const fs::path& path, std::map<std::string, SettingsValue>& va
|
|||||||
values.clear();
|
values.clear();
|
||||||
errors.clear();
|
errors.clear();
|
||||||
|
|
||||||
|
// Ok for file to not exist
|
||||||
|
if (!fs::exists(path)) return true;
|
||||||
|
|
||||||
fsbridge::ifstream file;
|
fsbridge::ifstream file;
|
||||||
file.open(path);
|
file.open(path);
|
||||||
if (!file.is_open()) return true; // Ok for file not to exist.
|
if (!file.is_open()) {
|
||||||
|
errors.emplace_back(strprintf("%s. Please check permissions.", path.string()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SettingsValue in;
|
SettingsValue in;
|
||||||
if (!in.read(std::string{std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()})) {
|
if (!in.read(std::string{std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()})) {
|
||||||
|
Reference in New Issue
Block a user