mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-08 08:52:15 +02:00
Check if configuration file exists before trying to load it (#909)
* Check if configuration file exists before trying to load it
This commit is contained in:
parent
2f22d38cb0
commit
9933d459ed
13
src/config.d
13
src/config.d
|
@ -146,17 +146,24 @@ final class Config
|
|||
|
||||
bool initialize()
|
||||
{
|
||||
if (!load(userConfigFilePath)) {
|
||||
// What was the reason for failure?
|
||||
// Initialise the application
|
||||
if (!exists(userConfigFilePath)) {
|
||||
// configuration file does not exist
|
||||
log.vlog("No config file found, using application defaults");
|
||||
return true;
|
||||
} else {
|
||||
// configuration file exists
|
||||
// can we load the configuration file without error?
|
||||
if (load(userConfigFilePath)) {
|
||||
// configuration file loaded without error
|
||||
log.log("Configuration file successfully loaded");
|
||||
return true;
|
||||
} else {
|
||||
// there was a problem loading the configuration file
|
||||
log.log("Configuration file has errors - please check your configuration");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void update_from_args(string[] args)
|
||||
|
|
Loading…
Reference in a new issue