Skip to content

Commit 4951de1

Browse files
committed
try to find maya if wrong application clicked
if it wasn't the maya exe that was clicked, still look through directory to see if we can find maya
1 parent 85138dd commit 4951de1

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,26 @@ public override void OnInspectorGUI() {
123123
string mayaPath = EditorUtility.OpenFilePanel ("Select Maya Application", ExportSettings.kDefaultAdskRoot, ext);
124124

125125
// check that the path is valid and references the maya executable
126-
if (!string.IsNullOrEmpty (mayaPath) &&
127-
Path.GetFileNameWithoutExtension (mayaPath).ToLower ().Equals ("maya")) {
126+
if (!string.IsNullOrEmpty (mayaPath)) {
127+
if (!Path.GetFileNameWithoutExtension (mayaPath).ToLower ().Equals ("maya")) {
128+
// clicked on the wrong application, try to see if we can still find
129+
// maya in this directory.
130+
var mayaDir = new DirectoryInfo(Path.GetDirectoryName(mayaPath));
131+
var files = mayaDir.GetFiles ("*." + ext);
132+
bool foundMaya = false;
133+
foreach (var file in files) {
134+
var filename = Path.GetFileNameWithoutExtension (file.Name).ToLower ();
135+
if (filename.Equals ("maya")) {
136+
mayaPath = file.FullName.Replace("\\","/");
137+
foundMaya = true;
138+
break;
139+
}
140+
}
141+
if (!foundMaya) {
142+
Debug.LogError (string.Format("Could not find Maya at: \"{0}\"", mayaDir.FullName));
143+
return;
144+
}
145+
}
128146
ExportSettings.AddMayaOption (mayaPath);
129147
Repaint ();
130148
} else {

0 commit comments

Comments
 (0)