| 65 | } |
| 66 | |
| 67 | void ConfigDate::createDefaultConfigFile(const std::string& filePath, const std::string& Config) |
| 68 | { |
| 69 | std::filesystem::path directory = std::filesystem::path(filePath).parent_path(); |
| 70 | if (!std::filesystem::exists(directory)) |
| 71 | { |
| 72 | if (!std::filesystem::create_directories(directory)) |
| 73 | { |
| 74 | std::cout << "无法创建配置文件夹。\n"; |
| 75 | exit(0); |
| 76 | } |
| 77 | } |
| 78 | std::ofstream file(filePath); |
| 79 | if (file.is_open()) |
| 80 | { |
| 81 | file << Config; |
| 82 | file.close(); |
| 83 | std::cout << "创建并写入默认配置文件成功。\n"; |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | std::cout << "无法创建配置文件。\n"; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | std::string ConfigDate::defaultConfig() |
| 92 | { |
nothing calls this directly
no outgoing calls
no test coverage detected