mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
TD-115: Throw error when config file is missing or not readable
TD-49: Log when file management fails - Thanks to Jelle van der Waa, Ben Boeckel.
This commit is contained in:
parent
152f9b0884
commit
64f87e3c38
3 changed files with 14 additions and 1 deletions
|
@ -50,7 +50,14 @@ void Rules::load (const std::string& file, int nest /* = 1 */)
|
|||
if (nest == 1)
|
||||
{
|
||||
_settings = defaultSettings;
|
||||
_original_file = File (file)._data;
|
||||
File originalFile (file);
|
||||
_original_file = originalFile._data;
|
||||
|
||||
if (! originalFile.exists ())
|
||||
throw std::string ("ERROR: Configuration file not found.");
|
||||
|
||||
if (! originalFile.readable ())
|
||||
throw std::string ("ERROR: Configuration file cannot be read (insufficient privileges).");
|
||||
}
|
||||
|
||||
// Read the file, then parse the contents.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue