@@ -277,35 +277,31 @@ public static string[] DCCVendorLocations {
277
277
}
278
278
}
279
279
280
- //Check the surrounding area around MAYA_LOCATION for any other Applications we may want.
281
280
var location = System . Environment . GetEnvironmentVariable ( "MAYA_LOCATION" ) ;
282
281
if ( ! string . IsNullOrEmpty ( location ) )
283
282
{
284
283
//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 ;
286
285
if ( Directory . GetParent ( location ) != null )
287
286
{
288
287
possibleLocation = Directory . GetParent ( location ) . ToString ( ) ;
289
288
}
290
289
291
290
if ( Application . platform == RuntimePlatform . OSXEditor )
292
291
{
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 )
300
296
{
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 )
307
299
{
308
- possibleLocation = parentDirectory . ToString ( ) ;
300
+ var autoDeskFolder = Directory . GetParent ( versionFolder . ToString ( ) ) ;
301
+ if ( autoDeskFolder != null )
302
+ {
303
+ possibleLocation = autoDeskFolder . ToString ( ) ;
304
+ }
309
305
}
310
306
}
311
307
}
0 commit comments