diff --git a/src/config.cpp b/src/config.cpp index 62baa9f..40a0017 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -5,7 +5,7 @@ #include #include #include "config.hpp" -#include "envmanager.hpp" +#include "utils/envmanager.hpp" namespace fs = boost::filesystem; namespace pt = boost::property_tree; diff --git a/src/help.cpp b/src/help.cpp index 7109d1d..03c1553 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -1,4 +1,4 @@ -#include "dropshell.hpp" +#include "main.hpp" #include namespace dropshell { diff --git a/src/servers.cpp b/src/servers.cpp index d3dba60..fb3e4b8 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -51,36 +51,7 @@ std::vector get_configured_servers() { return servers; } -void interactive_mode() { - interactive::fullscreen_window iw("DropShell Servers"); - iw.set_input_text_display("Loading all servers' status..."); - - auto servers = get_configured_servers(); - std::vector server_names; - for (const auto& server : servers) { - server_names.push_back(server.name); - } - - list_servers(); - - while (true) { - std::string server_name = iw.set_input_multiple_choice("Select a server", server_names); - if (server_name.empty()) - { - iw.close(); - return; - } - - while (!server_name.empty()) { - iw.clear_display(); - show_server_details(server_name); - server_name = iw.set_input_multiple_choice("Select a server", server_names, server_name); - } - iw.clear_display(); - list_servers(); - } -} void list_servers() { auto servers = get_configured_servers(); @@ -192,4 +163,39 @@ void show_server_details(const std::string& server_name) { } // end of list services } // end of show_server_details + + + + +void interactive_mode() { + interactive::fullscreen_window iw("DropShell Servers"); + + iw.set_input_text_display("Loading all servers' status..."); + + auto servers = get_configured_servers(); + std::vector server_names; + for (const auto& server : servers) { + server_names.push_back(server.name); + } + + list_servers(); + + while (true) { + std::string server_name = iw.set_input_multiple_choice("Select a server", server_names); + if (server_name.empty()) + { + iw.close(); + return; + } + + while (!server_name.empty()) { + iw.clear_display(); + show_server_details(server_name); + server_name = iw.set_input_multiple_choice("Select a server", server_names, server_name); + } + iw.clear_display(); + list_servers(); + } +} + } // namespace dropshell \ No newline at end of file diff --git a/src/status.cpp b/src/status.cpp index 73d7b4e..c0a5727 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -1,4 +1,4 @@ -#include "dropshell.hpp" +#include "main.hpp" #include #include #include diff --git a/src/templates.cpp b/src/templates.cpp index c63c2e4..669cf76 100644 --- a/src/templates.cpp +++ b/src/templates.cpp @@ -1,6 +1,5 @@ -#include "init_user_directory.hpp" #include "templates.hpp" -#include "config.hpp" +#include "config.hpp" #include "utils/directories.hpp" #include #include @@ -21,16 +20,7 @@ template_manager::~template_manager() { bool template_manager::get_templates(std::vector& templates) { templates.clear(); - - // System templates directory - const std::string system_templates_dir = get_local_system_templates_path(); - // User templates directory (from config) - std::string user_templates_dir; - if (!get_user_directory(user_templates_dir)) { - return false; - } - user_templates_dir += "/usertemplates"; - + // Helper function to add templates from a directory auto add_templates_from_dir = [&templates](const std::string& dir_path) { if (!std::filesystem::exists(dir_path)) { @@ -54,11 +44,8 @@ bool template_manager::get_templates(std::vector& templates) { } }; - // First add system templates - add_templates_from_dir(system_templates_dir); - - // Then add user templates (which will override system templates with same name) - add_templates_from_dir(user_templates_dir); + add_templates_from_dir(get_local_config_templates_path()); + add_templates_from_dir(get_local_system_templates_path()); return true; } diff --git a/src/version.cpp b/src/version.cpp index 309eae6..099d4a2 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -1,4 +1,4 @@ -#include "dropshell.hpp" +#include "main.hpp" #include namespace dropshell {