From 2f1e73741da625c173156102457d5442b27cd953 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 20 Apr 2025 19:20:33 +0530 Subject: Add configuration directory loading + --config-dir cli arg --- src/widgets/BrowserApp.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/widgets/BrowserApp.cpp') diff --git a/src/widgets/BrowserApp.cpp b/src/widgets/BrowserApp.cpp index 502d930..1362941 100644 --- a/src/widgets/BrowserApp.cpp +++ b/src/widgets/BrowserApp.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -6,7 +7,7 @@ #include "widgets/BrowserApp.hpp" #include "widgets/BrowserWindow.hpp" -BrowserApp::BrowserApp() { +BrowserApp::BrowserApp(Configuration &configuration) : configuration(configuration) { auto &lua = LuaRuntime::instance(); lua.start_event_loop(); @@ -17,8 +18,18 @@ BrowserApp::BrowserApp() { // Global event filter qApp->installEventFilter(this); - // NOTE: TMP - lua.load_file_sync("./config.lua"); + qDebug() << "Config dir:" << configuration.get_config_dir().path(); + + // Load lua directory into package path + lua.append_package_path(configuration.get_config_lua_dir()); + + // Load init.lua + auto lua_init_file = configuration.get_config_lua_init_file(); + if (QFile::exists(lua_init_file)) { + lua.load_file_sync(lua_init_file); + } else { + qWarning() << "Unable to find init.lua:" << lua_init_file; + } // Initializes profile for (auto *profile : profiles) { -- cgit v1.3.1