From 3ba4ac0cb19426f439d8fa955608337889a7cf0d Mon Sep 17 00:00:00 2001 From: "Asad M. Zaman" Date: Tue, 15 Nov 2005 00:50:08 +0000 Subject: [PATCH] removing the dependency on -rp and assuming that the first word of the filename will be the prefix to be replaced --- pandatool/src/mayaprogs/mayaCopy.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pandatool/src/mayaprogs/mayaCopy.cxx b/pandatool/src/mayaprogs/mayaCopy.cxx index 5fdb07693b..7ccd21dc13 100644 --- a/pandatool/src/mayaprogs/mayaCopy.cxx +++ b/pandatool/src/mayaprogs/mayaCopy.cxx @@ -192,10 +192,18 @@ copy_maya_file(const Filename &source, const Filename &dest, if (num_refs != 0) { if (_replace_prefix.find("none") != string::npos) { - maya_cat.error() - << "External references exist: " - << "please make sure to specify a _replace_prefix with -rp option\n"; - exit(1); + // try to put the first word of the file name as the replace prefix + size_t idx = source.get_basename().find("_",0); + if (idx != string::npos) { + string st = source.get_basename().substr(0, idx); + _replace_prefix = st; + } + else { + maya_cat.error() + << "External references exist: " + << "please make sure to specify a _replace_prefix with -rp option\n"; + exit(1); + } } }