Multiple directories
This commit is contained in:
@ -28,35 +28,41 @@ std::string get_local_system_templates_path()
|
||||
return "/opt/dropshell/templates";
|
||||
}
|
||||
|
||||
std::string get_local_config_path()
|
||||
int getNumConfigDirectories()
|
||||
{
|
||||
config *cfg = get_global_config();
|
||||
std::string user_dir;
|
||||
if (!cfg->get_local_config_directory(user_dir)) {
|
||||
return std::string();
|
||||
}
|
||||
return user_dir;
|
||||
std::vector<std::string> local_config_directories = cfg->get_local_config_directories();
|
||||
return local_config_directories.size();
|
||||
}
|
||||
|
||||
std::string get_local_config_templates_path()
|
||||
std::string get_local_config_path(int index)
|
||||
{
|
||||
std::string config_path = get_local_config_path();
|
||||
config *cfg = get_global_config();
|
||||
std::vector<std::string> local_config_directories = cfg->get_local_config_directories();
|
||||
if (index < 0 || index >= local_config_directories.size())
|
||||
return std::string();
|
||||
return local_config_directories[index];
|
||||
}
|
||||
|
||||
std::string get_local_config_templates_path(int index)
|
||||
{
|
||||
std::string config_path = get_local_config_path(index);
|
||||
if (config_path.empty())
|
||||
return std::string();
|
||||
return config_path + "/templates";
|
||||
}
|
||||
|
||||
std::string get_local_config_servers_path()
|
||||
std::string get_local_config_servers_path(int index)
|
||||
{
|
||||
std::string config_path = get_local_config_path();
|
||||
std::string config_path = get_local_config_path(index);
|
||||
if (config_path.empty())
|
||||
return std::string();
|
||||
return config_path + "/servers";
|
||||
}
|
||||
|
||||
std::string get_local_config_backups_path()
|
||||
std::string get_local_config_backups_path(int index)
|
||||
{
|
||||
std::string config_path = get_local_config_path();
|
||||
std::string config_path = get_local_config_path(index);
|
||||
if (config_path.empty())
|
||||
return std::string();
|
||||
return config_path + "/backups";
|
||||
@ -64,12 +70,15 @@ std::string get_local_config_backups_path()
|
||||
|
||||
std::string get_local_server_path(const std::string &server_name)
|
||||
{
|
||||
if (server_name.empty())
|
||||
return std::string();
|
||||
std::string config_path = get_local_config_path();
|
||||
if (config_path.empty())
|
||||
return std::string();
|
||||
return config_path + "/servers/" + server_name;
|
||||
config *cfg = get_global_config();
|
||||
std::vector<std::string> local_config_directories = cfg->get_local_config_directories();
|
||||
for (auto &dir : local_config_directories) {
|
||||
std::string server_path = dir + "/servers/" + server_name;
|
||||
if (fs::exists(server_path)) {
|
||||
return server_path;
|
||||
}
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string get_local_server_env_path(const std::string &server_name)
|
||||
|
Reference in New Issue
Block a user