Version the extension cache folders
Resolves wixtoolset/issues#6184
Rob Mensching committed
Mar 2, 2021 at 03:01 UTC
263c62069df0f154001915cca00d6d4926f2fbb5
1 file changed
+11
-7
src/WixToolset.Core/ExtensibilityServices/ExtensionManager.cs
+11
-7
@@ -13,8 +13,12 @@ namespace WixToolset.Core.ExtensibilityServices
13
14
internal class ExtensionManager : IExtensionManager
15
{
16
- private List<IExtensionFactory> extensionFactories = new List<IExtensionFactory>();
17
- private Dictionary<Type, List<object>> loadedExtensionsByType = new Dictionary<Type, List<object>>();
16
+ private const string UserWixFolderName = ".wix4";
17
+ private const string MachineWixFolderName = "WixToolset4";
18
+ private const string ExtensionsFolderName = "extensions";
19
+
20
+ private readonly List<IExtensionFactory> extensionFactories = new List<IExtensionFactory>();
21
+ private readonly Dictionary<Type, List<object>> loadedExtensionsByType = new Dictionary<Type, List<object>>();
22
23
public ExtensionManager(IWixToolsetCoreServiceProvider serviceProvider)
24
{
@@ -123,14 +127,14 @@ namespace WixToolset.Core.ExtensibilityServices
127
128
private IEnumerable<string> CacheLocations()
129
{
126
- var path = Path.Combine(Environment.CurrentDirectory, ".wix", "extensions");
130
+ var path = Path.Combine(Environment.CurrentDirectory, UserWixFolderName, ExtensionsFolderName);
131
if (Directory.Exists(path))
132
{
133
yield return path;
134
}
135
136
path = Environment.GetEnvironmentVariable("WIX_EXTENSIONS") ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
133
- path = Path.Combine(path, ".wix", "extensions");
137
+ path = Path.Combine(path, UserWixFolderName, ExtensionsFolderName);
138
if (Directory.Exists(path))
139
{
140
yield return path;
@@ -138,20 +142,20 @@ namespace WixToolset.Core.ExtensibilityServices
142
143
if (Environment.Is64BitOperatingSystem)
144
{
141
- path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles), @"WixToolset\extensions\");
145
+ path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles), MachineWixFolderName, ExtensionsFolderName);
146
if (Directory.Exists(path))
147
{
148
yield return path;
149
}
150
}
151
148
- path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86), @"WixToolset\extensions\");
152
+ path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86), MachineWixFolderName, ExtensionsFolderName);
153
if (Directory.Exists(path))
154
{
155
yield return path;
156
}
157
154
- path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetCallingAssembly().CodeBase).LocalPath), @"extensions\");
158
+ path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetCallingAssembly().CodeBase).LocalPath), ExtensionsFolderName);
159
if (Directory.Exists(path))
160
{
161
yield return path;