@@ -282,23 +282,27 @@ public static string[] DCCVendorLocations {
282
282
var location = System . Environment . GetEnvironmentVariable ( "MAYA_LOCATION" ) ;
283
283
if ( ! string . IsNullOrEmpty ( location ) )
284
284
{
285
- //If we are on Windows, we need only go up one location to get to the "Autodesk" folder.
286
285
string possibleLocation = null ;
287
- if ( Directory . GetParent ( location ) != null )
286
+ if ( Application . platform == RuntimePlatform . WindowsEditor )
288
287
{
289
- possibleLocation = Directory . GetParent ( location ) . ToString ( ) ;
290
-
291
- //Make sure the user defined path is not included in the default paths
292
- for ( int i = 0 ; i < WindowsDefaultLocations . Count ; i ++ )
288
+ //If we are on Windows, we need only go up one location to get to the "Autodesk" folder.
289
+ if ( Directory . GetParent ( location ) != null )
293
290
{
294
- if ( WindowsDefaultLocations [ i ] . Equals ( possibleLocation ) )
291
+ possibleLocation = Directory . GetParent ( location ) . ToString ( ) ;
292
+
293
+ //Make sure the user defined path is not included in the default paths
294
+ for ( int i = 0 ; i < WindowsDefaultLocations . Count ; i ++ )
295
295
{
296
- possibleLocation = null ;
296
+ //we don't want a minute difference in slashes or capitalization to throw off our check
297
+ if ( WindowsDefaultLocations [ i ] . Replace ( "\\ " , "/" ) . ToLower ( ) . Equals ( possibleLocation . Replace ( "\\ " , "/" ) . ToLower ( ) ) )
298
+ {
299
+ possibleLocation = null ;
300
+ continue ;
301
+ }
297
302
}
298
303
}
299
304
}
300
-
301
- if ( Application . platform == RuntimePlatform . OSXEditor )
305
+ else if ( Application . platform == RuntimePlatform . OSXEditor )
302
306
{
303
307
//We can assume our path is: /Applications/Autodesk/maya2017/Maya.app/Contents
304
308
//So we need to go up three folders.
@@ -316,19 +320,38 @@ public static string[] DCCVendorLocations {
316
320
//Make sure the user defined path is not included in the default paths
317
321
for ( int i = 0 ; i < OSXDefaultLocations . Count ; i ++ )
318
322
{
319
- if ( OSXDefaultLocations [ i ] . Equals ( possibleLocation ) )
323
+ //we don't want a minute difference in slashes or capitalization to throw off our check
324
+ if ( OSXDefaultLocations [ i ] . Replace ( "\\ " , "/" ) . ToLower ( ) . Equals ( possibleLocation . Replace ( "\\ " , "/" ) . ToLower ( ) ) )
320
325
{
321
326
possibleLocation = null ;
327
+ continue ;
322
328
}
323
329
}
324
330
}
325
331
}
326
332
}
327
333
}
334
+ else
335
+ {
336
+ throw new NotImplementedException ( ) ;
337
+ }
328
338
329
339
if ( ! string . IsNullOrEmpty ( possibleLocation ) && Directory . Exists ( possibleLocation ) )
330
340
{
331
- locationsList . Add ( possibleLocation . ToString ( ) ) ;
341
+ bool foundDuplicate = false ;
342
+ for ( int i = 0 ; i < locationsList . Count ; i ++ )
343
+ {
344
+ if ( locationsList [ i ] . Replace ( "\\ " , "/" ) . ToLower ( ) . Equals ( possibleLocation . Replace ( "\\ " , "/" ) . ToLower ( ) ) )
345
+ {
346
+ foundDuplicate = true ;
347
+ break ;
348
+ }
349
+ }
350
+
351
+ if ( ! foundDuplicate )
352
+ {
353
+ locationsList . Add ( possibleLocation . ToString ( ) ) ;
354
+ }
332
355
}
333
356
}
334
357
0 commit comments