mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 06:15:32 +00:00
since the default method is not available in older boost we should check by ourselfs if the options are given and dont use notify
This commit is contained in:
parent
6022d3ab13
commit
89565bacd1
1 changed files with 5 additions and 19 deletions
|
@ -9,7 +9,7 @@ namespace bpo = boost::program_options;
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
bpo::options_description desc("Syntax: mwiniimporter <options>\nAllowed options");
|
||||
bpo::options_description desc("Syntax: mwiniimporter -i inifile -c configfile <options>\nAllowed options");
|
||||
desc.add_options()
|
||||
("help,h", "produce help message")
|
||||
("verbose,v", "verbose output")
|
||||
|
@ -20,25 +20,11 @@ int main(int argc, char *argv[]) {
|
|||
;
|
||||
|
||||
bpo::variables_map vm;
|
||||
try {
|
||||
bpo::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
|
||||
bpo::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
|
||||
|
||||
// parse help before calling notify because we dont want it to throw an error if help is set
|
||||
if(vm.count("help")) {
|
||||
std::cout << desc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bpo::notify(vm);
|
||||
|
||||
}
|
||||
catch(std::exception& e) {
|
||||
std::cerr << "Error:" << e.what() << std::endl;
|
||||
return -1;
|
||||
}
|
||||
catch(...) {
|
||||
std::cerr << "Error" << std::endl;
|
||||
return -2;
|
||||
if(vm.count("help") || !vm.count("ini") || !vm.count("cfg")) {
|
||||
std::cout << desc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string iniFile = vm["ini"].as<std::string>();
|
||||
|
|
Loading…
Reference in a new issue