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:
Paul Beckingham 2016-03-26 10:35:18 -04:00
parent 152f9b0884
commit 64f87e3c38
3 changed files with 14 additions and 1 deletions

View file

@ -10,6 +10,7 @@ The following submitted code, packages or analysis, and deserve special thanks:
Tomas Babej
Dirk Deimeke
Wim Schuermann
Jelle van der Waa
Thanks to the following, who submitted detailed bug reports and excellent
suggestions:
@ -18,3 +19,4 @@ suggestions:
creatid
Frédéric Meynadier
Bruno Vernay
Ben Boeckel

View file

@ -3,6 +3,10 @@
0.1.0 () -
- TD-49 Log when file management fails
(thanks to Ben Boeckel).
- TD-115 Throw error when config file is missing or not readable
(thanks to Jelle van der Waa).
- Added 'continue' command.
- Added 'diagnostics' command.
- Added 'export' command.

View file

@ -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.