diff --git a/PreCompiledHeaders.cmake b/PreCompiledHeaders.cmake index f09e72ab569a20b3f841dd0b73132b36f301481f..4d9128d51cc5e265dd3cf53dbec087f2675115e1 100644 --- a/PreCompiledHeaders.cmake +++ b/PreCompiledHeaders.cmake @@ -24,6 +24,7 @@ set(STL_INC <ctype.h> <mutex> <iomanip> + <filesystem> ) set(EXT_INC PRIVATE diff --git a/src/Lib/Log.cc b/src/Lib/Log.cc index b18598aed73f6bf726a61a24fa65e3c41fdeb1f2..4da5f3b178144b5efe7bccc8db5a28045317d55c 100644 --- a/src/Lib/Log.cc +++ b/src/Lib/Log.cc @@ -29,6 +29,12 @@ StderrLogSinkDispatcher::trunkFileName(const char *fileName) noexcept fileNameView.data() + fileNameView.size() }; } +std::string +StderrLogSinkDispatcher::reduceFileName(const std::string_view fileName) noexcept +{ + return std::filesystem::path(fileName).lexically_normal(); +} + StderrLogSinkDispatcher::StderrLogSinkDispatcher() noexcept : LogSinkDispatcher(std::string_view{ "stderr" }) { @@ -38,7 +44,7 @@ void StderrLogSinkDispatcher::handleLogMessage(const std::string_view category, const LogMessage &msg) noexcept { - std::cerr << "#(" << trunkFileName(msg.getHeader().fileName) << " +" + std::cerr << "#(" << reduceFileName(trunkFileName(msg.getHeader().fileName)) << " +" << msg.getHeader().lineNumberInFile << " | " << LogLevel::toStdStringView(msg.getHeader().severity) << " -> " << category << ") " << msg.getTextBuffer() << '\n'; diff --git a/src/Lib/Log.hh b/src/Lib/Log.hh index 1aa83afa3b5577438e1e9268560e50ee7d92c341..31b0ebc837e536c4c6f6f9c7489dbcad4882ae8b 100644 --- a/src/Lib/Log.hh +++ b/src/Lib/Log.hh @@ -115,6 +115,7 @@ class StderrLogSinkDispatcher : public LogSinkDispatcher { VIVY_UNMOVABLE_OBJECT(StderrLogSinkDispatcher) static const std::string_view trunkFileName(const char *) noexcept; + static std::string reduceFileName(const std::string_view) noexcept; public: explicit StderrLogSinkDispatcher() noexcept; diff --git a/src/Lib/Script/CRTPLuaScriptObject/ModuleDeclaration.cc b/src/Lib/Script/CRTPLuaScriptObject/ModuleDeclaration.cc index 1a35f0ce6bf7101fa8698d3945018e934a54f5c4..5de28117202757c0e20870b0a2204d6987b20308 100644 --- a/src/Lib/Script/CRTPLuaScriptObject/ModuleDeclaration.cc +++ b/src/Lib/Script/CRTPLuaScriptObject/ModuleDeclaration.cc @@ -7,12 +7,11 @@ ModuleDeclaration::resolvModules(LuaContext *const context) noexcept { for (const auto &str : importNames) { const ModuleDeclaration *const mod = context->getModule(str); - if (mod) { + if (mod) importedModules.emplace_back(mod); - } else { + + else context->failedWith("Failed to find needed module: " + str); - return false; - } } return true; } diff --git a/src/VivyApplication.cc b/src/VivyApplication.cc index 50b8648280244aba73b8025501014616736c17df..343b2f1469ee29e8e618cba87b849c1baeeba98d 100644 --- a/src/VivyApplication.cc +++ b/src/VivyApplication.cc @@ -111,7 +111,7 @@ VivyApplication::getApplicationFont(Font id) const noexcept } // Let the program crash - qFatal("UNREACHABLE"); + logFatal() << "Unreachable"; } MainWindow *