From b8da3c6c32ba611142e71059e62c2dcd764c2de0 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 2 Nov 2005 18:57:00 +0000 Subject: [PATCH] add -D option --- panda/src/testbed/pview.cxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/panda/src/testbed/pview.cxx b/panda/src/testbed/pview.cxx index 10a18d579b..68baab8ac0 100644 --- a/panda/src/testbed/pview.cxx +++ b/panda/src/testbed/pview.cxx @@ -233,6 +233,10 @@ help() { " After displaying the models, immediately take a screenshot and\n" " exit.\n\n" + " -D\n" + " Delete the model files after loading them (presumably this option\n" + " will only be used when loading a temporary model file).\n\n" + " -V\n" " Report the current version of Panda, and exit.\n\n" @@ -260,10 +264,11 @@ main(int argc, char *argv[]) { int hierarchy_match_flags = PartGroup::HMF_ok_part_extra | PartGroup::HMF_ok_anim_extra; Filename screenshotfn; + bool delete_models = false; extern char *optarg; extern int optind; - static const char *optflags = "acls:Vhi"; + static const char *optflags = "acls:DVhi"; int flag = getopt(argc, argv, optflags); while (flag != EOF) { @@ -290,6 +295,10 @@ main(int argc, char *argv[]) { screenshotfn = optarg; break; + case 'D': + delete_models = true; + break; + case 'V': report_version(); return 1; @@ -343,6 +352,16 @@ main(int argc, char *argv[]) { window->load_default_model(framework.get_models()); } else { window->load_models(framework.get_models(), argc, argv); + + if (delete_models) { + for (int i = 1; i < argc && argv[i] != (char *)NULL; i++) { + Filename model = Filename::from_os_specific(argv[i]); + if (model.exists()) { + nout << "Deleting " << model << "\n"; + model.unlink(); + } + } + } } window->loop_animations(hierarchy_match_flags);