diff --git a/pandatool/src/mayaprogs/mayapath.cxx b/pandatool/src/mayaprogs/mayapath.cxx index e2163798ca..2ec5f54fa7 100755 --- a/pandatool/src/mayaprogs/mayapath.cxx +++ b/pandatool/src/mayaprogs/mayapath.cxx @@ -59,6 +59,11 @@ main(int argc, char *argv[]) { cerr << "The directory referred to by $MAYA_LOCATION does not exist!\n"; exit(1); } + + // Reset maya_location to its full long name, since Maya seems to + // require that. + maya_location.make_canonical(); + maya_location = Filename::from_os_specific(maya_location.to_os_long_name()); // Look for OpenMaya.dll as a sanity check. Filename openMaya = Filename::dso_filename(Filename(maya_location, "bin/OpenMaya.so")); @@ -67,6 +72,13 @@ main(int argc, char *argv[]) { exit(1); } + // Re-set MAYA_LOCATION to its properly sanitized form. + { + string putenv_str = "MAYA_LOCATION=" + maya_location.to_os_specific(); + char *putenv_cstr = strdup(putenv_str.c_str()); + putenv(putenv_cstr); + } + // Now set PYTHONHOME & PYTHONPATH. Maya2008 requires this to be // set and pointing within $MAYA_LOCATION, or it might get itself // confused with another Python installation (e.g. Panda's).