瀏覽代碼

further sanitize MAYA_LOCATION

David Rose 17 年之前
父節點
當前提交
53aa703996
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12 0
      pandatool/src/mayaprogs/mayapath.cxx

+ 12 - 0
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).