mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
use from_os_specific on all filenames on command line.
This commit is contained in:
parent
fa9028eec6
commit
e12722220f
@ -115,7 +115,7 @@ handle_args(ProgramBase::Args &args) {
|
|||||||
|
|
||||||
Args::const_iterator ai;
|
Args::const_iterator ai;
|
||||||
for (ai = args.begin(); ai != args.end(); ++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) {
|
if (data == (EggData *)NULL) {
|
||||||
// Rather than returning false, we simply exit here, so the
|
// Rather than returning false, we simply exit here, so the
|
||||||
// ProgramBase won't try to tell the user how to run the program
|
// ProgramBase won't try to tell the user how to run the program
|
||||||
|
@ -160,11 +160,11 @@ handle_args(ProgramBase::Args &args) {
|
|||||||
// get implicitly loaded up into one big egg file.
|
// get implicitly loaded up into one big egg file.
|
||||||
|
|
||||||
if (!args.empty()) {
|
if (!args.empty()) {
|
||||||
_data.set_egg_filename(args[0]);
|
_data.set_egg_filename(Filename::from_os_specific(args[0]));
|
||||||
}
|
}
|
||||||
Args::const_iterator ai;
|
Args::const_iterator ai;
|
||||||
for (ai = args.begin(); ai != args.end(); ++ai) {
|
for (ai = args.begin(); ai != args.end(); ++ai) {
|
||||||
Filename filename = *ai;
|
Filename filename = Filename::from_os_specific(*ai);
|
||||||
|
|
||||||
EggData file_data;
|
EggData file_data;
|
||||||
if (!file_data.read(filename)) {
|
if (!file_data.read(filename)) {
|
||||||
|
@ -233,7 +233,7 @@ bool SomethingToEgg::
|
|||||||
handle_args(Args &args) {
|
handle_args(Args &args) {
|
||||||
if (_allow_last_param && !_got_output_filename && args.size() > 1) {
|
if (_allow_last_param && !_got_output_filename && args.size() > 1) {
|
||||||
_got_output_filename = true;
|
_got_output_filename = true;
|
||||||
_output_filename = args.back();
|
_output_filename = Filename::from_os_specific(args.back());
|
||||||
args.pop_back();
|
args.pop_back();
|
||||||
|
|
||||||
if (!(_output_filename.get_extension() == "egg")) {
|
if (!(_output_filename.get_extension() == "egg")) {
|
||||||
@ -266,7 +266,7 @@ handle_args(Args &args) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_input_filename = args[0];
|
_input_filename = Filename::from_os_specific(args[0]);
|
||||||
|
|
||||||
if (!_input_filename.exists()) {
|
if (!_input_filename.exists()) {
|
||||||
nout << "Cannot find input file " << _input_filename << "\n";
|
nout << "Cannot find input file " << _input_filename << "\n";
|
||||||
|
@ -46,16 +46,6 @@ FltCopy() {
|
|||||||
clear_runlines();
|
clear_runlines();
|
||||||
add_runline("[opts] file.flt [file.flt ... ]");
|
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();
|
add_path_replace_options();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,8 +72,6 @@ private:
|
|||||||
typedef pset< PT(FltTexture) > Textures;
|
typedef pset< PT(FltTexture) > Textures;
|
||||||
|
|
||||||
void scan_flt(FltRecord *record, Refs &refs, Textures &textures);
|
void scan_flt(FltRecord *record, Refs &refs, Textures &textures);
|
||||||
|
|
||||||
DSearchPath _search_path;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -107,7 +107,7 @@ handle_args(ProgramBase::Args &args) {
|
|||||||
<< "the last parameter on the command line.\n";
|
<< "the last parameter on the command line.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_output_filename = args[0];
|
_output_filename = Filename::from_os_specific(args[0]);
|
||||||
_got_output_filename = true;
|
_got_output_filename = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1009,7 +1009,7 @@ dispatch_filename(const string &opt, const string &arg, void *var) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Filename *ip = (Filename *)var;
|
Filename *ip = (Filename *)var;
|
||||||
(*ip) = arg;
|
(*ip) = Filename::from_os_specific(arg);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1019,10 +1019,10 @@ dispatch_filename(const string &opt, const string &arg, void *var) {
|
|||||||
// Access: Protected, Static
|
// Access: Protected, Static
|
||||||
// Description: Standard dispatch function for an option that takes
|
// Description: Standard dispatch function for an option that takes
|
||||||
// one parameter, which is to be interpreted as a
|
// one parameter, which is to be interpreted as a
|
||||||
// colon-delimited search path. The data pointer is to
|
// single directory name to add to a search path. The
|
||||||
// a DSearchPath variable. This kind of option may
|
// data pointer is to a DSearchPath variable. This kind
|
||||||
// appear multiple times on the command line; each time,
|
// of option may appear multiple times on the command
|
||||||
// the new search paths are appended.
|
// line; each time, the new directory is appended.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool ProgramBase::
|
bool ProgramBase::
|
||||||
dispatch_search_path(const string &opt, const string &arg, void *var) {
|
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;
|
DSearchPath *ip = (DSearchPath *)var;
|
||||||
ip->append_path(arg);
|
ip->append_directory(Filename::from_os_specific(arg));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ bool WithOutputFile::
|
|||||||
check_last_arg(ProgramBase::Args &args, int minimum_args) {
|
check_last_arg(ProgramBase::Args &args, int minimum_args) {
|
||||||
if (_allow_last_param && !_got_output_filename &&
|
if (_allow_last_param && !_got_output_filename &&
|
||||||
(int)args.size() > minimum_args) {
|
(int)args.size() > minimum_args) {
|
||||||
Filename filename = args.back();
|
Filename filename = Filename::from_os_specific(args.back());
|
||||||
|
|
||||||
if (!_preferred_extension.empty() &&
|
if (!_preferred_extension.empty() &&
|
||||||
("." + filename.get_extension()) != _preferred_extension) {
|
("." + filename.get_extension()) != _preferred_extension) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user