diff --git a/source/DependenciesReport/AddinUtilities.cs b/source/DependenciesReport/AddinUtilities.cs index e6915e99..2212c48d 100644 --- a/source/DependenciesReport/AddinUtilities.cs +++ b/source/DependenciesReport/AddinUtilities.cs @@ -13,9 +13,13 @@ public static IGrouping[] GetAddinLocations() var machineAddinsPath = Path.Combine(machineFolder, "Autodesk", "Revit", "Addins"); var storeAddinsPath = Path.Combine(machineFolder, "Autodesk", "ApplicationPlugins"); - return Directory.EnumerateFiles(userAddinsPath, "*.addin", SearchOption.AllDirectories) - .Union(Directory.EnumerateFiles(machineAddinsPath, "*.addin", SearchOption.AllDirectories)) - .Union(Directory.EnumerateFiles(storeAddinsPath, "*.addin", SearchOption.AllDirectories)) + var addinFiles = Enumerable.Empty(); + + if (Directory.Exists(userAddinsPath)) addinFiles = addinFiles.Union(EnumerateAddins(userAddinsPath)); + if (Directory.Exists(machineAddinsPath)) addinFiles = addinFiles.Union(EnumerateAddins(machineAddinsPath)); + if (Directory.Exists(storeAddinsPath)) addinFiles = addinFiles.Union(EnumerateAddins(storeAddinsPath)); + + return addinFiles .GroupBy(file => Path.GetFileName(Path.GetDirectoryName(file))!) .ToArray(); } @@ -53,10 +57,15 @@ public static Dictionary GetAddinDirectories(IGrouping EnumerateAddins(string folder) + { + return Directory.EnumerateFiles(folder, "*.addin", SearchOption.AllDirectories); + } } \ No newline at end of file diff --git a/source/DependenciesReport/DependenciesUtilities.cs b/source/DependenciesReport/DependenciesUtilities.cs index a631d0e1..df128582 100644 --- a/source/DependenciesReport/DependenciesUtilities.cs +++ b/source/DependenciesReport/DependenciesUtilities.cs @@ -26,7 +26,7 @@ public static List CreateDependenciesMap(Dictionary