From 7a4036490cf9671883148f49f56b1122746a922c Mon Sep 17 00:00:00 2001 From: taynpg Date: Sun, 15 Mar 2026 11:23:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=94=9F=E6=88=90=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileUpdater/main.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/fileUpdater/main.cpp b/fileUpdater/main.cpp index 28cd9a0..69b6d0d 100644 --- a/fileUpdater/main.cpp +++ b/fileUpdater/main.cpp @@ -84,8 +84,9 @@ public: // 解析命令行参数 bool parseArguments(int argc, char** argv) { - auto msg = fmt::format("fileUpdater - 文件更新工具 \n\n {} on {} at {} {}", VERSION_GIT_COMMIT, VERSION_GIT_BRANCH, - __DATE__, __TIME__); + auto notice = "使用特殊参数 default 可生成一个默认配置文件模板。"; + auto msg = fmt::format("fileUpdater - 文件更新工具 \n\n {} on {} at {} {}\n{}", VERSION_GIT_COMMIT, VERSION_GIT_BRANCH, + __DATE__, __TIME__, notice); CLI::App app{msg}; argv = app.ensure_utf8(argv); @@ -479,6 +480,28 @@ int main(int argc, char** argv) zoostCommon::SetOutputU8(); zoostCommon::SetStdLibrayU8(); + if (argc > 1) { + std::string specialStr = argv[1]; + if (specialStr == "default") { + std::string defaultContent = + R"( + + + + +)"; + std::ifstream ifs("fileUpdater.xml"); + if (!ifs) { + std::ofstream ofs("fileUpdater.xml"); + ofs << defaultContent; + ofs.close(); + } + ifs.close(); + boost::nowide::cout << "已生成默认配置文件: fileUpdater.xml" << std::endl; + return 0; + } + } + AutoUpdateTool tool; if (tool.parseArguments(argc, argv)) {