Skip to content

Commit a18cf92

Browse files
author
AJubrey
committed
[CHANGED] we now check for duplicates within the lists, and these checks are tolerant of different slashes and capitalization
[ADDED] check for if we're on windows, so we dont waste some operations by default [ADDED] an exception for if you're on linux because we don't support it yet :(
1 parent 850b50a commit a18cf92

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -282,23 +282,27 @@ public static string[] DCCVendorLocations {
282282
var location = System.Environment.GetEnvironmentVariable("MAYA_LOCATION");
283283
if (!string.IsNullOrEmpty(location))
284284
{
285-
//If we are on Windows, we need only go up one location to get to the "Autodesk" folder.
286285
string possibleLocation = null;
287-
if (Directory.GetParent(location) != null)
286+
if (Application.platform == RuntimePlatform.WindowsEditor)
288287
{
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)
293290
{
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++)
295295
{
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+
}
297302
}
298303
}
299304
}
300-
301-
if (Application.platform == RuntimePlatform.OSXEditor)
305+
else if (Application.platform == RuntimePlatform.OSXEditor)
302306
{
303307
//We can assume our path is: /Applications/Autodesk/maya2017/Maya.app/Contents
304308
//So we need to go up three folders.
@@ -316,19 +320,38 @@ public static string[] DCCVendorLocations {
316320
//Make sure the user defined path is not included in the default paths
317321
for (int i = 0; i < OSXDefaultLocations.Count; i++)
318322
{
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()))
320325
{
321326
possibleLocation = null;
327+
continue;
322328
}
323329
}
324330
}
325331
}
326332
}
327333
}
334+
else
335+
{
336+
throw new NotImplementedException();
337+
}
328338

329339
if (!string.IsNullOrEmpty(possibleLocation) && Directory.Exists(possibleLocation))
330340
{
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+
}
332355
}
333356
}
334357

0 commit comments

Comments
 (0)