mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-21 20:08:20 +00:00
Add condition to prevent options -o and -e being used together
This commit is contained in:
parent
a320248857
commit
682a272f91
14
main.cpp
14
main.cpp
@ -1863,6 +1863,15 @@ static bool has_name(struct option *long_options, int *pl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool findFlag(int argc, char **argv, std::string str) {
|
||||
char **ptr = std::find(argv, argv + argc, str);
|
||||
|
||||
if (ptr != argv + argc)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#ifdef MTRACE
|
||||
mtrace();
|
||||
@ -2256,6 +2265,11 @@ int main(int argc, char **argv) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if ((findFlag(argc, argv, "-o") && findFlag(argc, argv, "-e")) || (findFlag(argc, argv, "--output") && findFlag(argc, argv, "--output-to-directory"))) {
|
||||
fprintf(stderr, "%s: Options -o and -e cannot be used together\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (force) {
|
||||
unlink(outdir);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user