mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2025-12-20 23:12:40 +00:00
Make arg parsing more generic and fix running with no args
Some checks failed
validate / blaze/ubuntu-22.04 (arm64, Debug) (push) Has been cancelled
validate / blaze/ubuntu-22.04 (arm64, Release) (push) Has been cancelled
validate / macos-14 (arm64, Debug) (push) Has been cancelled
validate / macos-14 (arm64, Release) (push) Has been cancelled
validate / macos-15-intel (x64, Debug) (push) Has been cancelled
validate / macos-15-intel (x64, Release) (push) Has been cancelled
validate / ubuntu-latest (x64, Debug) (push) Has been cancelled
validate / ubuntu-latest (x64, Release) (push) Has been cancelled
validate / windows-latest (x64, Debug) (push) Has been cancelled
validate / windows-latest (x64, Release) (push) Has been cancelled
Some checks failed
validate / blaze/ubuntu-22.04 (arm64, Debug) (push) Has been cancelled
validate / blaze/ubuntu-22.04 (arm64, Release) (push) Has been cancelled
validate / macos-14 (arm64, Debug) (push) Has been cancelled
validate / macos-14 (arm64, Release) (push) Has been cancelled
validate / macos-15-intel (x64, Debug) (push) Has been cancelled
validate / macos-15-intel (x64, Release) (push) Has been cancelled
validate / ubuntu-latest (x64, Debug) (push) Has been cancelled
validate / ubuntu-latest (x64, Release) (push) Has been cancelled
validate / windows-latest (x64, Debug) (push) Has been cancelled
validate / windows-latest (x64, Release) (push) Has been cancelled
This commit is contained in:
parent
f14ffe6064
commit
0fab168437
1 changed files with 15 additions and 11 deletions
24
src/main.cpp
24
src/main.cpp
|
|
@ -272,22 +272,26 @@ int main(int argc, char** argv) {
|
||||||
std::exit(EXIT_FAILURE);
|
std::exit(EXIT_FAILURE);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool dumping_context;
|
bool dumping_context = false;
|
||||||
|
|
||||||
if (argc >= 3) {
|
if (argc < 2) {
|
||||||
std::string arg2 = argv[2];
|
|
||||||
if (arg2 == "--dump-context") {
|
|
||||||
dumping_context = true;
|
|
||||||
} else {
|
|
||||||
fmt::print("Usage: {} <config file> [--dump-context]\n", argv[0]);
|
fmt::print("Usage: {} <config file> [--dump-context]\n", argv[0]);
|
||||||
std::exit(EXIT_SUCCESS);
|
return EXIT_SUCCESS;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dumping_context = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* config_path = argv[1];
|
const char* config_path = argv[1];
|
||||||
|
|
||||||
|
for (size_t i = 2; i < argc; i++) {
|
||||||
|
std::string_view cur_arg = argv[i];
|
||||||
|
if (cur_arg == "--dump-context") {
|
||||||
|
dumping_context = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fmt::print("Unknown argument \"{}\"\n", cur_arg);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
N64Recomp::Config config{ config_path };
|
N64Recomp::Config config{ config_path };
|
||||||
if (!config.good()) {
|
if (!config.good()) {
|
||||||
exit_failure(fmt::format("Failed to load config file: {}\n", config_path));
|
exit_failure(fmt::format("Failed to load config file: {}\n", config_path));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue