This commit is contained in:
Your Name
2025-04-21 11:29:39 +12:00
parent 10d663971c
commit 43a10f5c3f
4 changed files with 36 additions and 1 deletions

View File

@ -78,11 +78,17 @@ void init_user_directory(const std::string& path) {
// Convert to absolute path
fs::path abs_path = fs::absolute(path);
// Create directory if it doesn't exist
// The directory must exist
if (!fs::exists(abs_path)) {
throw std::runtime_error("The user directory does not exist: " + abs_path.string());
}
// create the servers subdirectory if it doesn't exist
fs::path servers_dir = abs_path / "servers";
if (!fs::exists(servers_dir)) {
fs::create_directories(servers_dir);
}
// Update config file
std::string config_path;
if (!get_config_path(config_path)) {