summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-08-20 18:15:19 +0200
committerHaru <haru@dotalux.com>2016-08-20 18:15:19 +0200
commitf77278551b125da51b6917c53e608abdecdd146c (patch)
treef1073cde5d92757eaa4a5b3f02b9c04b6ee05405 /src/common
parentaf77eec4f736f989703f81df903a1a7c971fa659 (diff)
downloadhercules-f77278551b125da51b6917c53e608abdecdd146c.tar.gz
hercules-f77278551b125da51b6917c53e608abdecdd146c.tar.bz2
hercules-f77278551b125da51b6917c53e608abdecdd146c.tar.xz
hercules-f77278551b125da51b6917c53e608abdecdd146c.zip
Added a better error message when a libconfig file is not found
Previously, it'd say "[Error] (null):0 - file I/O error" Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/conf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/conf.c b/src/common/conf.c
index 25f1013f5..9188affa4 100644
--- a/src/common/conf.c
+++ b/src/common/conf.c
@@ -24,6 +24,7 @@
#include "common/showmsg.h" // ShowError
#include "common/strlib.h" // safestrncpy
+#include "common/utils.h" // exists
#include <libconfig/libconfig.h>
@@ -46,6 +47,10 @@ struct libconfig_interface *libconfig;
int config_load_file(struct config_t *config, const char *config_filename)
{
libconfig->init(config);
+ if (!exists(config_filename)) {
+ ShowError("Unable to load '%s' - File not found\n", config_filename);
+ return CONFIG_FALSE;
+ }
if (libconfig->read_file_src(config, config_filename) != CONFIG_TRUE) {
ShowError("%s:%d - %s\n", config_error_file(config),
config_error_line(config), config_error_text(config));