From 2ad76278ddac518d1c03eb15f6b0dfe518c4ca30 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 5 Aug 2017 18:31:26 -0400 Subject: [PATCH] Use full path to file for conf.cpp file could not be opened error message --- include/config.h | 1 + src/config.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/config.h b/include/config.h index 8af12fe52..d6ee24554 100644 --- a/include/config.h +++ b/include/config.h @@ -78,6 +78,7 @@ namespace Configuration File(const Anope::string &, bool); ~File(); const Anope::string &GetName() const; + Anope::string GetPath() const; bool IsOpen() const; bool Open(); diff --git a/src/config.cpp b/src/config.cpp index 03ee9feb6..65a2c756c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -665,6 +665,11 @@ const Anope::string &File::GetName() const return this->name; } +Anope::string File::GetPath() const +{ + return (this->executable ? "" : Anope::ConfigDir + "/") + this->name; +} + bool File::IsOpen() const { return this->fp != NULL; @@ -722,14 +727,14 @@ void Conf::LoadConf(File &file) return; if (!file.Open()) - throw ConfigException("File " + file.GetName() + " could not be opened."); + throw ConfigException("File " + file.GetPath() + " could not be opened."); Anope::string itemname, wordbuffer; std::stack block_stack; int linenumber = 0; bool in_word = false, in_quote = false, in_comment = false; - Log(LOG_DEBUG) << "Start to read conf " << file.GetName(); + Log(LOG_DEBUG) << "Start to read conf " << file.GetPath(); // Start reading characters... while (!file.End()) {