From e12722220f1aee42c500151b481b3b2834274c78 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 11 Mar 2003 02:29:55 +0000 Subject: [PATCH] use from_os_specific on all filenames on command line. --- pandatool/src/eggbase/eggMultiFilter.cxx | 2 +- pandatool/src/eggbase/eggReader.cxx | 4 ++-- pandatool/src/eggbase/somethingToEgg.cxx | 4 ++-- pandatool/src/fltprogs/fltCopy.cxx | 10 ---------- pandatool/src/fltprogs/fltCopy.h | 2 -- pandatool/src/imagebase/imageWriter.cxx | 2 +- pandatool/src/progbase/programBase.cxx | 12 ++++++------ pandatool/src/progbase/withOutputFile.cxx | 2 +- 8 files changed, 13 insertions(+), 25 deletions(-) diff --git a/pandatool/src/eggbase/eggMultiFilter.cxx b/pandatool/src/eggbase/eggMultiFilter.cxx index 78442d71d9..7ab9811417 100644 --- a/pandatool/src/eggbase/eggMultiFilter.cxx +++ b/pandatool/src/eggbase/eggMultiFilter.cxx @@ -115,7 +115,7 @@ handle_args(ProgramBase::Args &args) { Args::const_iterator ai; for (ai = args.begin(); ai != args.end(); ++ai) { - PT(EggData) data = read_egg(*ai); + PT(EggData) data = read_egg(Filename::from_os_specific(*ai)); if (data == (EggData *)NULL) { // Rather than returning false, we simply exit here, so the // ProgramBase won't try to tell the user how to run the program diff --git a/pandatool/src/eggbase/eggReader.cxx b/pandatool/src/eggbase/eggReader.cxx index ae12a0ebcb..e62b6f5b17 100644 --- a/pandatool/src/eggbase/eggReader.cxx +++ b/pandatool/src/eggbase/eggReader.cxx @@ -160,11 +160,11 @@ handle_args(ProgramBase::Args &args) { // get implicitly loaded up into one big egg file. if (!args.empty()) { - _data.set_egg_filename(args[0]); + _data.set_egg_filename(Filename::from_os_specific(args[0])); } Args::const_iterator ai; for (ai = args.begin(); ai != args.end(); ++ai) { - Filename filename = *ai; + Filename filename = Filename::from_os_specific(*ai); EggData file_data; if (!file_data.read(filename)) { diff --git a/pandatool/src/eggbase/somethingToEgg.cxx b/pandatool/src/eggbase/somethingToEgg.cxx index 8467981c2b..6f0676c9de 100644 --- a/pandatool/src/eggbase/somethingToEgg.cxx +++ b/pandatool/src/eggbase/somethingToEgg.cxx @@ -233,7 +233,7 @@ bool SomethingToEgg:: handle_args(Args &args) { if (_allow_last_param && !_got_output_filename && args.size() > 1) { _got_output_filename = true; - _output_filename = args.back(); + _output_filename = Filename::from_os_specific(args.back()); args.pop_back(); if (!(_output_filename.get_extension() == "egg")) { @@ -266,7 +266,7 @@ handle_args(Args &args) { return false; } - _input_filename = args[0]; + _input_filename = Filename::from_os_specific(args[0]); if (!_input_filename.exists()) { nout << "Cannot find input file " << _input_filename << "\n"; diff --git a/pandatool/src/fltprogs/fltCopy.cxx b/pandatool/src/fltprogs/fltCopy.cxx index 894e127ce9..752a8750e7 100644 --- a/pandatool/src/fltprogs/fltCopy.cxx +++ b/pandatool/src/fltprogs/fltCopy.cxx @@ -46,16 +46,6 @@ FltCopy() { clear_runlines(); add_runline("[opts] file.flt [file.flt ... ]"); - add_option - ("s", "dirname", 0, - "Specify the directory or directories that are to be searched for " - "relative pathnames appearing in the flt file. This may be a " - "single directory name or a colon-delimited list of directories. " - "It may also be " - "repeated multiple times on the command line; each time it appears " - "its named directories will be appended to the search path.", - &FltCopy::dispatch_search_path, NULL, &_search_path); - add_path_replace_options(); } diff --git a/pandatool/src/fltprogs/fltCopy.h b/pandatool/src/fltprogs/fltCopy.h index e17cb68256..eac491bd23 100644 --- a/pandatool/src/fltprogs/fltCopy.h +++ b/pandatool/src/fltprogs/fltCopy.h @@ -72,8 +72,6 @@ private: typedef pset< PT(FltTexture) > Textures; void scan_flt(FltRecord *record, Refs &refs, Textures &textures); - - DSearchPath _search_path; }; #endif diff --git a/pandatool/src/imagebase/imageWriter.cxx b/pandatool/src/imagebase/imageWriter.cxx index ac0d40a38c..3d88d62faf 100644 --- a/pandatool/src/imagebase/imageWriter.cxx +++ b/pandatool/src/imagebase/imageWriter.cxx @@ -107,7 +107,7 @@ handle_args(ProgramBase::Args &args) { << "the last parameter on the command line.\n"; return false; } - _output_filename = args[0]; + _output_filename = Filename::from_os_specific(args[0]); _got_output_filename = true; } else { diff --git a/pandatool/src/progbase/programBase.cxx b/pandatool/src/progbase/programBase.cxx index 2d6e51282c..e576488d9e 100644 --- a/pandatool/src/progbase/programBase.cxx +++ b/pandatool/src/progbase/programBase.cxx @@ -1009,7 +1009,7 @@ dispatch_filename(const string &opt, const string &arg, void *var) { } Filename *ip = (Filename *)var; - (*ip) = arg; + (*ip) = Filename::from_os_specific(arg); return true; } @@ -1019,10 +1019,10 @@ dispatch_filename(const string &opt, const string &arg, void *var) { // Access: Protected, Static // Description: Standard dispatch function for an option that takes // one parameter, which is to be interpreted as a -// colon-delimited search path. The data pointer is to -// a DSearchPath variable. This kind of option may -// appear multiple times on the command line; each time, -// the new search paths are appended. +// single directory name to add to a search path. The +// data pointer is to a DSearchPath variable. This kind +// of option may appear multiple times on the command +// line; each time, the new directory is appended. //////////////////////////////////////////////////////////////////// bool ProgramBase:: dispatch_search_path(const string &opt, const string &arg, void *var) { @@ -1032,7 +1032,7 @@ dispatch_search_path(const string &opt, const string &arg, void *var) { } DSearchPath *ip = (DSearchPath *)var; - ip->append_path(arg); + ip->append_directory(Filename::from_os_specific(arg)); return true; } diff --git a/pandatool/src/progbase/withOutputFile.cxx b/pandatool/src/progbase/withOutputFile.cxx index 56535d33b0..2261b75441 100644 --- a/pandatool/src/progbase/withOutputFile.cxx +++ b/pandatool/src/progbase/withOutputFile.cxx @@ -126,7 +126,7 @@ bool WithOutputFile:: check_last_arg(ProgramBase::Args &args, int minimum_args) { if (_allow_last_param && !_got_output_filename && (int)args.size() > minimum_args) { - Filename filename = args.back(); + Filename filename = Filename::from_os_specific(args.back()); if (!_preferred_extension.empty() && ("." + filename.get_extension()) != _preferred_extension) {