summaryrefslogtreecommitdiff
path: root/src/tools/dcpomatic_cli.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/dcpomatic_cli.cc')
-rw-r--r--src/tools/dcpomatic_cli.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc
index 65252ff29..5a7ec3c72 100644
--- a/src/tools/dcpomatic_cli.cc
+++ b/src/tools/dcpomatic_cli.cc
@@ -260,6 +260,9 @@ show_jobs_on_console (bool progress)
int
main (int argc, char* argv[])
{
+ ArgFixer fixer(argc, argv);
+ auto const program_name = fixer.argv()[0];
+
boost::filesystem::path film_dir;
bool progress = true;
bool no_remote = false;
@@ -300,7 +303,7 @@ main (int argc, char* argv[])
{ 0, 0, 0, 0 }
};
- int c = getopt_long (argc, argv, "vhfnrt:j:kAs:ldc:BC:D:E", long_options, &option_index);
+ int c = getopt_long(fixer.argc(), fixer.argv(), "vhfnrt:j:kAs:ldc:BC:D:E", long_options, &option_index);
if (c == -1) {
break;
@@ -311,7 +314,7 @@ main (int argc, char* argv[])
cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n";
exit (EXIT_SUCCESS);
case 'h':
- help (argv[0]);
+ help(program_name);
exit (EXIT_SUCCESS);
case 'f':
cout << dcpomatic_cxx_flags << "\n";
@@ -387,8 +390,8 @@ main (int argc, char* argv[])
exit (EXIT_SUCCESS);
}
- if (optind >= argc) {
- help (argv[0]);
+ if (optind >= fixer.argc()) {
+ help(program_name);
exit (EXIT_FAILURE);
}
@@ -407,7 +410,7 @@ main (int argc, char* argv[])
exit (EXIT_FAILURE);
}
- film_dir = argv[optind];
+ film_dir = fixer.argv()[optind];
dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
@@ -430,7 +433,7 @@ main (int argc, char* argv[])
film.reset (new Film (film_dir));
film->read_metadata ();
} catch (std::exception& e) {
- cerr << argv[0] << ": error reading film `" << film_dir.string() << "' (" << e.what() << ")\n";
+ cerr << program_name << ": error reading film `" << film_dir.string() << "' (" << e.what() << ")\n";
exit (EXIT_FAILURE);
}
@@ -445,7 +448,7 @@ main (int argc, char* argv[])
auto paths = i->paths();
for (auto j: paths) {
if (!dcp::filesystem::exists(j)) {
- cerr << argv[0] << ": content file " << j << " not found.\n";
+ cerr << program_name << ": content file " << j << " not found.\n";
exit (EXIT_FAILURE);
}
}