mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-20 22:56:36 +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
17
src/config.d
17
src/config.d
|
@ -146,17 +146,24 @@ final class Config
|
||||||
|
|
||||||
bool initialize()
|
bool initialize()
|
||||||
{
|
{
|
||||||
if (!load(userConfigFilePath)) {
|
// Initialise the application
|
||||||
// What was the reason for failure?
|
if (!exists(userConfigFilePath)) {
|
||||||
if (!exists(userConfigFilePath)) {
|
// configuration file does not exist
|
||||||
log.vlog("No config file found, using application defaults");
|
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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
// there was a problem loading the configuration file
|
||||||
log.log("Configuration file has errors - please check your configuration");
|
log.log("Configuration file has errors - please check your configuration");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_from_args(string[] args)
|
void update_from_args(string[] args)
|
||||||
|
|
Loading…
Reference in a new issue