Skip to content

Commit 7722717

Browse files
committed
check maya not installed
1 parent 9e96413 commit 7722717

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ private static string GetUserFolder()
3737
#endif
3838
}
3939

40-
public static string BuildCommandLineArgs (List<string> argsList)
41-
{
42-
System.Text.StringBuilder sb = new System.Text.StringBuilder ();
43-
44-
foreach (string arg in argsList) {
45-
sb.Append ("\"\"" + arg.Replace ("\"", @"\" + "\"") + "\"\" ");
46-
}
47-
48-
if (sb.Length > 0) {
49-
sb = sb.Remove (sb.Length - 1, 1);
50-
}
51-
52-
return sb.ToString ();
53-
}
54-
5540
private static string GetModulePath(string version)
5641
{
5742
string result = System.IO.Path.Combine(GetUserFolder(), REL_MAYA_MODULES_PATH);
@@ -182,13 +167,29 @@ public static int ConfigureMaya(string version)
182167

183168
#if UNITY_EDITOR_OSX
184169
myProcess.StartInfo.FileName = "open";
185-
string mayaCommandLine = string.Format(@"/Applications/Autodesk/maya{0}/Maya.app --args -command '{1}'", version, MAYA_COMMANDS);
170+
string mayaPath = string.Format ("/Applications/Autodesk/maya{0}/Maya.app", version);
171+
172+
if (!System.IO.Directory.Exists(mayaPath))
173+
{
174+
Debug.LogError (string.Format ("No maya installation found at {0}",mayaPath));
175+
return -1;
176+
}
177+
178+
string mayaCommandLine = string.Format(@"{0} --args -command '{1}'", mayaPath, MAYA_COMMANDS);
186179
myProcess.StartInfo.Arguments = "-a " + mayaCommandLine;
187180
#elif UNITY_EDITOR_LINUX
188181
throw new NotImplementedException();
189182
#else
183+
string mayaPath = string.Format ("C:/Program Files/Autodesk/Maya{0}/maya.exe", version);
184+
185+
if (!System.IO.File.Exists(mayaPath))
186+
{
187+
Debug.LogError (string.Format ("No maya installation found at {0}", mayaPath));
188+
return -1;
189+
}
190+
190191
myProcess.StartInfo.FileName = "C:/Windows/system32/cmd.exe";
191-
string mayaCommandLine = string.Format("C:/Program Files/Autodesk/Maya{0}/maya.exe -command '{1}'", version, MAYA_COMMANDS);
192+
string mayaCommandLine = string.Format("{0} -command '{1}'", mayaPath, MAYA_COMMANDS);
192193
myProcess.StartInfo.Arguments = "/c " + mayaCommandLine;
193194
#endif
194195
myProcess.EnableRaisingEvents = true;

0 commit comments

Comments
 (0)