#ifndef DIRECTORIES_HPP #define DIRECTORIES_HPP #include #include namespace dropshell { // all functions return empty string on failure //------------------------------------------------------------------------------------------------ // local user config directories // ~/.config/dropshell/dropshell.json // ~/.local/dropshell_agent // |-- agent-local // |-- agent-install.sh // |-- bb64 (only used locally, as it's for the local machine's architecture!) // |-- template_example // |-- agent-remote // |-- (remote agent files, including _allservicesstatus.sh) // ~/.local/dropshell_files // |-- backups // |-- katie-_-squashkiwi-_-squashkiwi-test-_-2025-04-28_21-23-59.tgz // |-- temp_files // |-- template_cache // |-- templates // | |-- .json // | |-- // | |-- (...script files...) // | |-- _default.env // | |-- config // | |-- service.env // | |-- .template_info.env // | |-- (...other service config files...) // |-- remote_versions // | |-- server_name-service_name.json // server_definition_path // |-- // |-- server.json // |-- services // |-- // |-- service.env // |-- .template_info.env // |-- (...other config files for specific server&service...) namespace localfile { // ~/.config/dropshell/dropshell.json std::string dropshell_json(); std::string server_json(const std::string &server_name); std::string service_env(const std::string &server_name, const std::string &service_name); std::string template_info_env(const std::string &server_name, const std::string &service_name); std::string template_example(); std::string bb64(); } // namespace localfile namespace localpath { std::string server(const std::string &server_name); std::string service(const std::string &server_name, const std::string &service_name); std::string remote_versions(const std::string &server_name, const std::string &service_name); std::string agent_local(); std::string agent_remote(); std::string current_user_home(); std::string dropshell_files(); std::string backups(); std::string temp_files(); std::string template_cache(); bool create_directories(); } // namespace local //------------------------------------------------------------------------------------------------ // remote paths // DROPSHELL_DIR // |-- backups // |-- temp_files // |-- agent // | |-- bb64 // | |-- (other agent files, including _allservicesstatus.sh) // |-- services // |-- service name // |-- config // |-- service.env (actual service config) // |-- .template_info.env // |-- template // |-- _default.env // |-- (script files) // |-- config // |-- service.env (default service config) // |-- .template_info.env // |-- (other config files for specific server&service) class remotefile { public: remotefile(const std::string &server_name, const std::string &user); std::string service_env(const std::string &service_name) const; private: std::string mServer_name; std::string mUser; }; class remotepath { public: remotepath(const std::string &server_name, const std::string &user); std::string DROPSHELL_DIR() const; std::string services() const; std::string service(const std::string &service_name) const; std::string service_config(const std::string &service_name) const; std::string service_template(const std::string &service_name) const; std::string backups() const; std::string temp_files() const; std::string agent() const; private: std::string mServer_name; std::string mUser; }; //------------------------------------------------------------------------------------------------ // utility functions std::string get_parent(const std::filesystem::path path); std::string get_child(const std::filesystem::path path); } // namespace dropshell #endif // DIRECTORIES_HPP