Skip to content

Commit

Permalink
调整输出路径
Browse files Browse the repository at this point in the history
  • Loading branch information
uuiid committed Jan 26, 2024
1 parent 64d0402 commit 18d12dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ int main(int argc, char *argv[]) try {
std::locale::global(boost::locale::generator{}("zh_CN.UTF-8"));
std::setlocale(LC_ALL, "zh_CN.UTF-8");

argh::parser cmdl{{"--config", "--subscribe", "--out"}};
argh::parser cmdl{};
cmdl.parse(argc, argv);

boost::asio::io_context l_io_context{};
Expand Down Expand Up @@ -341,7 +341,9 @@ int main(int argc, char *argv[]) try {
return 1;
l_json["outbounds"].push_back(l_default_proxy);
set_log(l_json);
std::ofstream{cmdl("out").str()} << l_json.dump(2) << std::endl;
std::filesystem::path l_out_path{cmdl("config").str()};
if(cmdl("out")) l_out_path = cmdl("out").str();
std::ofstream{l_out_path} << l_json.dump(2) << std::endl;
return 0;
} catch (const std::exception &e) {
std::cout << fmt::format("{}", e.what()) << std::endl;
Expand Down

0 comments on commit 18d12dc

Please sign in to comment.