diff options
author | Rob Mensching <rob@firegiant.com> | 2020-06-10 07:44:29 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2020-06-10 07:51:45 -0700 |
commit | 33f14b793d674355f87f0224f5be3329c3c12d56 (patch) | |
tree | 2f90b81ffed35c1abb0ee6acecf6f11dadca6e48 /src | |
parent | c58da76f6b8c41f645582fb9a5cd8cacf6fede8d (diff) | |
download | wix-33f14b793d674355f87f0224f5be3329c3c12d56.tar.gz wix-33f14b793d674355f87f0224f5be3329c3c12d56.tar.bz2 wix-33f14b793d674355f87f0224f5be3329c3c12d56.zip |
Fix crossplat pathing and other small issues in extension caching
Diffstat (limited to 'src')
4 files changed, 11 insertions, 15 deletions
diff --git a/src/WixToolset.Core.ExtensionCache/CachedExtension.cs b/src/WixToolset.Core.ExtensionCache/CachedExtension.cs index 9ed874d9..5567541c 100644 --- a/src/WixToolset.Core.ExtensionCache/CachedExtension.cs +++ b/src/WixToolset.Core.ExtensionCache/CachedExtension.cs | |||
@@ -2,9 +2,9 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core.ExtensionCache | 3 | namespace WixToolset.Core.ExtensionCache |
4 | { | 4 | { |
5 | public class CachedExtension | 5 | internal class CachedExtension |
6 | { | 6 | { |
7 | internal CachedExtension(string id, string version, bool damaged) | 7 | public CachedExtension(string id, string version, bool damaged) |
8 | { | 8 | { |
9 | this.Id = id; | 9 | this.Id = id; |
10 | this.Version = version; | 10 | this.Version = version; |
diff --git a/src/WixToolset.Core.ExtensionCache/ExtensionCacheManager.cs b/src/WixToolset.Core.ExtensionCache/ExtensionCacheManager.cs index 3ec6451e..256eeb0b 100644 --- a/src/WixToolset.Core.ExtensionCache/ExtensionCacheManager.cs +++ b/src/WixToolset.Core.ExtensionCache/ExtensionCacheManager.cs | |||
@@ -19,16 +19,16 @@ namespace WixToolset.Core.ExtensionCache | |||
19 | /// <summary> | 19 | /// <summary> |
20 | /// Extension cache manager. | 20 | /// Extension cache manager. |
21 | /// </summary> | 21 | /// </summary> |
22 | public class ExtensionCacheManager | 22 | internal class ExtensionCacheManager |
23 | { | 23 | { |
24 | public string CacheFolder(bool global) => global ? this.GlobalCacheFolder() : this.LocalCacheFolder(); | 24 | public string CacheFolder(bool global) => global ? this.GlobalCacheFolder() : this.LocalCacheFolder(); |
25 | 25 | ||
26 | public string LocalCacheFolder() => Path.Combine(Environment.CurrentDirectory, @".wix\extensions\"); | 26 | public string LocalCacheFolder() => Path.Combine(Environment.CurrentDirectory, ".wix", "extensions"); |
27 | 27 | ||
28 | public string GlobalCacheFolder() | 28 | public string GlobalCacheFolder() |
29 | { | 29 | { |
30 | var baseFolder = Environment.GetEnvironmentVariable("WIX_EXTENSIONS") ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); | 30 | var baseFolder = Environment.GetEnvironmentVariable("WIX_EXTENSIONS") ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); |
31 | return Path.Combine(baseFolder, @".wix\extensions\"); | 31 | return Path.Combine(baseFolder, ".wix", "extensions"); |
32 | } | 32 | } |
33 | 33 | ||
34 | public async Task<bool> AddAsync(bool global, string extension, CancellationToken cancellationToken) | 34 | public async Task<bool> AddAsync(bool global, string extension, CancellationToken cancellationToken) |
@@ -84,12 +84,8 @@ namespace WixToolset.Core.ExtensionCache | |||
84 | } | 84 | } |
85 | else if (!String.IsNullOrEmpty(extensionVersion)) // looking for an explicit version of an extension. | 85 | else if (!String.IsNullOrEmpty(extensionVersion)) // looking for an explicit version of an extension. |
86 | { | 86 | { |
87 | var extensionFolder = Path.Combine(cacheFolder, extensionId, extensionVersion); | 87 | var present = ExtensionFileExists(cacheFolder, extensionId, extensionVersion); |
88 | if (Directory.Exists(extensionFolder)) | 88 | found.Add(new CachedExtension(extensionId, extensionVersion, !present)); |
89 | { | ||
90 | var present = ExtensionFileExists(cacheFolder, extensionId, extensionVersion); | ||
91 | found.Add(new CachedExtension(extensionId, extensionVersion, !present)); | ||
92 | } | ||
93 | } | 89 | } |
94 | else // looking for all versions of an extension or all versions of all extensions. | 90 | else // looking for all versions of an extension or all versions of all extensions. |
95 | { | 91 | { |
diff --git a/src/WixToolset.Core.ExtensionCache/ExtensionCacheManagerCommand.cs b/src/WixToolset.Core.ExtensionCache/ExtensionCacheManagerCommand.cs index 5016f430..24f17d06 100644 --- a/src/WixToolset.Core.ExtensionCache/ExtensionCacheManagerCommand.cs +++ b/src/WixToolset.Core.ExtensionCache/ExtensionCacheManagerCommand.cs | |||
@@ -116,7 +116,7 @@ namespace WixToolset.Core.ExtensionCache | |||
116 | 116 | ||
117 | private async Task<bool> AddExtensions(ExtensionCacheManager cacheManager, CancellationToken cancellationToken) | 117 | private async Task<bool> AddExtensions(ExtensionCacheManager cacheManager, CancellationToken cancellationToken) |
118 | { | 118 | { |
119 | var success = true; | 119 | var success = false; |
120 | 120 | ||
121 | foreach (var extensionRef in this.ExtensionReferences) | 121 | foreach (var extensionRef in this.ExtensionReferences) |
122 | { | 122 | { |
@@ -129,7 +129,7 @@ namespace WixToolset.Core.ExtensionCache | |||
129 | 129 | ||
130 | private async Task<bool> RemoveExtensions(ExtensionCacheManager cacheManager, CancellationToken cancellationToken) | 130 | private async Task<bool> RemoveExtensions(ExtensionCacheManager cacheManager, CancellationToken cancellationToken) |
131 | { | 131 | { |
132 | var success = true; | 132 | var success = false; |
133 | 133 | ||
134 | foreach (var extensionRef in this.ExtensionReferences) | 134 | foreach (var extensionRef in this.ExtensionReferences) |
135 | { | 135 | { |
diff --git a/src/WixToolset.Core/ExtensibilityServices/ExtensionManager.cs b/src/WixToolset.Core/ExtensibilityServices/ExtensionManager.cs index f71c0fd1..c23c8383 100644 --- a/src/WixToolset.Core/ExtensibilityServices/ExtensionManager.cs +++ b/src/WixToolset.Core/ExtensibilityServices/ExtensionManager.cs | |||
@@ -123,14 +123,14 @@ namespace WixToolset.Core.ExtensibilityServices | |||
123 | 123 | ||
124 | private IEnumerable<string> CacheLocations() | 124 | private IEnumerable<string> CacheLocations() |
125 | { | 125 | { |
126 | var path = Path.Combine(Environment.CurrentDirectory, @".wix\extensions\"); | 126 | var path = Path.Combine(Environment.CurrentDirectory, ".wix", "extensions"); |
127 | if (Directory.Exists(path)) | 127 | if (Directory.Exists(path)) |
128 | { | 128 | { |
129 | yield return path; | 129 | yield return path; |
130 | } | 130 | } |
131 | 131 | ||
132 | path = Environment.GetEnvironmentVariable("WIX_EXTENSIONS") ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); | 132 | path = Environment.GetEnvironmentVariable("WIX_EXTENSIONS") ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); |
133 | path = Path.Combine(path, @".wix\extensions\"); | 133 | path = Path.Combine(path, ".wix", "extensions"); |
134 | if (Directory.Exists(path)) | 134 | if (Directory.Exists(path)) |
135 | { | 135 | { |
136 | yield return path; | 136 | yield return path; |