dropshell/source/src/utils/directories.hpp
Your Name 399fe1d549
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
Aligning the different parts with the new directory and file structure.
2025-05-17 12:16:25 +12:00

112 lines
4.2 KiB
C++

#ifndef DIRECTORIES_HPP
#define DIRECTORIES_HPP
#include <string>
#include <filesystem>
namespace dropshell {
// all functions return empty string on failure
//------------------------------------------------------------------------------------------------
// local user config directories
// ~/.config/dropshell/dropshell.json
// ~/.local/dropshell_agent
// |-- bb64 (only used locally, as it's for the local machine's architecture!)
// |-- files_for_remote_agent
// |-- (other agent files, including _allservicesstatus.sh)
// server_definition_path
// |-- <server_name>
// |-- server.json
// |-- services
// |-- <service_name>
// |-- service.env
// |-- .template_info.env
// |-- (...other config files for specific server&service...)
// backup path
// |-- katie-_-squashkiwi-_-squashkiwi-test-_-2025-04-28_21-23-59.tgz
// temp files path
// template cache path
// |-- templates
// | |-- <template_name>.json
// | |-- <template_name>
// | |-- (...script files...)
// | |-- _default.env
// | |-- config
// | |-- service.env
// | |-- .template_info.env
// | |-- (...other service config files...)
// |-- remote_versions
// | |-- server_name-service_name.json
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);
} // 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();
std::string files_for_remote_agent();
std::string current_user_home();
} // 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)
namespace remotefile {
std::string service_env(const std::string &server_name, const std::string &service_name);
} // namespace remotefile
namespace remotepath {
std::string DROPSHELL_DIR(const std::string &server_name);
std::string services(const std::string &server_name);
std::string service(const std::string &server_name, const std::string &service_name);
std::string service_config(const std::string &server_name, const std::string &service_name);
std::string service_template(const std::string &server_name, const std::string &service_name);
std::string backups(const std::string &server_name);
std::string temp_files(const std::string &server_name);
std::string agent(const std::string &server_name);
} // namespace remotepath
//------------------------------------------------------------------------------------------------
// 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