mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 00:16:22 +01:00
Merge pull request #537 from mikkeloscar/exit-on-config-missing
Gracefully exit when config is not found
This commit is contained in:
commit
dcf5c67681
2 changed files with 8 additions and 3 deletions
|
@ -256,7 +256,7 @@ bool load_config(const char *file) {
|
||||||
|
|
||||||
FILE *f = fopen(path, "r");
|
FILE *f = fopen(path, "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fprintf(stderr, "Unable to open %s for reading", path);
|
sway_log(L_ERROR, "Unable to open %s for reading", path);
|
||||||
free(path);
|
free(path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,11 @@ bool load_config(const char *file) {
|
||||||
|
|
||||||
update_active_bar_modifiers();
|
update_active_bar_modifiers();
|
||||||
|
|
||||||
return config_load_success;
|
if (!config_load_success) {
|
||||||
|
sway_log(L_ERROR, "Error(s) loading config!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool read_config(FILE *file, bool is_active) {
|
bool read_config(FILE *file, bool is_active) {
|
||||||
|
|
|
@ -211,8 +211,9 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!load_config(config_path)) {
|
if (!load_config(config_path)) {
|
||||||
sway_log(L_ERROR, "Error(s) loading config!");
|
sway_terminate(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_path) {
|
if (config_path) {
|
||||||
free(config_path);
|
free(config_path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue