Skip to content

Commit

Permalink
Skip thru loop when file/folder not found
Browse files Browse the repository at this point in the history
  • Loading branch information
GewoonJaap committed Jul 3, 2021
1 parent 2a55b23 commit 8cc2ca9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Util/AddonScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ private static List<string> GetInstalledLiveries(string communityFolder)
foreach (string addonDirectory in addonDirectories)
{
string finalDirectory = addonDirectory;
if (!Directory.Exists(addonDirectory + "\\manifest.json")) continue;

JObject manifest = JObject.Parse(File.ReadAllText(addonDirectory + "\\manifest.json"));
if (((string)manifest["content_type"])?.ToLower() != "aircraft") continue;
finalDirectory += "\\SimObjects\\Airplanes";

if (!Directory.Exists(finalDirectory)) continue;

string[] airplaneDirectories = Directory.GetDirectories(finalDirectory);
finalDirectory = airplaneDirectories[0] + "\\aircraft.cfg";

if (!Directory.Exists(finalDirectory)) continue;

liveries.AddRange(ParseCfg(finalDirectory));
}
return liveries;
Expand Down

0 comments on commit 8cc2ca9

Please sign in to comment.