Skip to content

Commit 2b07126

Browse files
committed
error if settings.json exists, but is unreadable
1 parent da1c0c6 commit 2b07126

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/util/settings.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,15 @@ bool ReadSettings(const fs::path& path, std::map<std::string, SettingsValue>& va
6060
values.clear();
6161
errors.clear();
6262

63+
// Ok for file to not exist
64+
if (!fs::exists(path)) return true;
65+
6366
fsbridge::ifstream file;
6467
file.open(path);
65-
if (!file.is_open()) return true; // Ok for file not to exist.
68+
if (!file.is_open()) {
69+
errors.emplace_back(strprintf("%s. Please check permissions.", path.string()));
70+
return false;
71+
}
6672

6773
SettingsValue in;
6874
if (!in.read(std::string{std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()})) {

0 commit comments

Comments
 (0)