Skip to content

Commit 3a4c146

Browse files
author
AJubrey
committed
[CHANGED] MAYA_LOCATION code to specifically pinpoint the autoDesk folder under the asusmption of the location given by the user
[CHANGED] possibleLocation to be initialized to null so that it would not be passed through if it isn't what we're looking for
1 parent 6a2bd09 commit 3a4c146

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -277,35 +277,31 @@ public static string[] DCCVendorLocations {
277277
}
278278
}
279279

280-
//Check the surrounding area around MAYA_LOCATION for any other Applications we may want.
281280
var location = System.Environment.GetEnvironmentVariable("MAYA_LOCATION");
282281
if (!string.IsNullOrEmpty(location))
283282
{
284283
//If we are on Windows, we need only go up one location to get to the "Autodesk" folder.
285-
string possibleLocation = location;
284+
string possibleLocation = null;
286285
if (Directory.GetParent(location) != null)
287286
{
288287
possibleLocation = Directory.GetParent(location).ToString();
289288
}
290289

291290
if (Application.platform == RuntimePlatform.OSXEditor)
292291
{
293-
int appIndex = location.IndexOf("Maya.app");
294-
295-
//If we found 'Maya.app' in the location string, we're going to trim it and everything after it out.
296-
//This way our possibleLocation will be more uniform between windows and mac.
297-
298-
//make sure we found "maya.app."
299-
if (appIndex >= 0)
292+
//We can assume our path is: /Applications/Autodesk/maya2017/Maya.app/Contents
293+
//So we need to go up three folders.
294+
var appFolder = Directory.GetParent(location);
295+
if (appFolder != null)
300296
{
301-
//get everything up until 'maya.app'
302-
string subLocation = location.Substring(0, (appIndex - 1));
303-
304-
var parentDirectory = Directory.GetParent(subLocation);
305-
306-
if (parentDirectory != null)
297+
var versionFolder = Directory.GetParent(appFolder.ToString());
298+
if (versionFolder != null)
307299
{
308-
possibleLocation = parentDirectory.ToString();
300+
var autoDeskFolder = Directory.GetParent(versionFolder.ToString());
301+
if (autoDeskFolder != null)
302+
{
303+
possibleLocation = autoDeskFolder.ToString();
304+
}
309305
}
310306
}
311307
}

0 commit comments

Comments
 (0)