From 33f14b793d674355f87f0224f5be3329c3c12d56 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 10 Jun 2020 07:44:29 -0700 Subject: Fix crossplat pathing and other small issues in extension caching --- src/WixToolset.Core.ExtensionCache/CachedExtension.cs | 4 ++-- .../ExtensionCacheManager.cs | 14 +++++--------- .../ExtensionCacheManagerCommand.cs | 4 ++-- .../ExtensibilityServices/ExtensionManager.cs | 4 ++-- 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 @@ namespace WixToolset.Core.ExtensionCache { - public class CachedExtension + internal class CachedExtension { - internal CachedExtension(string id, string version, bool damaged) + public CachedExtension(string id, string version, bool damaged) { this.Id = id; 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 /// /// Extension cache manager. /// - public class ExtensionCacheManager + internal class ExtensionCacheManager { public string CacheFolder(bool global) => global ? this.GlobalCacheFolder() : this.LocalCacheFolder(); - public string LocalCacheFolder() => Path.Combine(Environment.CurrentDirectory, @".wix\extensions\"); + public string LocalCacheFolder() => Path.Combine(Environment.CurrentDirectory, ".wix", "extensions"); public string GlobalCacheFolder() { var baseFolder = Environment.GetEnvironmentVariable("WIX_EXTENSIONS") ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); - return Path.Combine(baseFolder, @".wix\extensions\"); + return Path.Combine(baseFolder, ".wix", "extensions"); } public async Task AddAsync(bool global, string extension, CancellationToken cancellationToken) @@ -84,12 +84,8 @@ namespace WixToolset.Core.ExtensionCache } else if (!String.IsNullOrEmpty(extensionVersion)) // looking for an explicit version of an extension. { - var extensionFolder = Path.Combine(cacheFolder, extensionId, extensionVersion); - if (Directory.Exists(extensionFolder)) - { - var present = ExtensionFileExists(cacheFolder, extensionId, extensionVersion); - found.Add(new CachedExtension(extensionId, extensionVersion, !present)); - } + var present = ExtensionFileExists(cacheFolder, extensionId, extensionVersion); + found.Add(new CachedExtension(extensionId, extensionVersion, !present)); } else // looking for all versions of an extension or all versions of all extensions. { 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 private async Task AddExtensions(ExtensionCacheManager cacheManager, CancellationToken cancellationToken) { - var success = true; + var success = false; foreach (var extensionRef in this.ExtensionReferences) { @@ -129,7 +129,7 @@ namespace WixToolset.Core.ExtensionCache private async Task RemoveExtensions(ExtensionCacheManager cacheManager, CancellationToken cancellationToken) { - var success = true; + var success = false; foreach (var extensionRef in this.ExtensionReferences) { 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 private IEnumerable CacheLocations() { - var path = Path.Combine(Environment.CurrentDirectory, @".wix\extensions\"); + var path = Path.Combine(Environment.CurrentDirectory, ".wix", "extensions"); if (Directory.Exists(path)) { yield return path; } path = Environment.GetEnvironmentVariable("WIX_EXTENSIONS") ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); - path = Path.Combine(path, @".wix\extensions\"); + path = Path.Combine(path, ".wix", "extensions"); if (Directory.Exists(path)) { yield return path; -- cgit v1.2.3-55-g6feb