From c7598852aa29370a78db3b976896f3cc8316b0e4 Mon Sep 17 00:00:00 2001 From: Jimmy Lewis Date: Sat, 26 Oct 2019 23:06:05 -0700 Subject: [PATCH] Move the file cache to %LocalAppData% This fixes #511, so that downloaded files do not get included in user profile roaming. --- src/LibraryManager/CacheService/CacheService.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/LibraryManager/CacheService/CacheService.cs b/src/LibraryManager/CacheService/CacheService.cs index 0e2cca6d..e5d6d5ee 100644 --- a/src/LibraryManager/CacheService/CacheService.cs +++ b/src/LibraryManager/CacheService/CacheService.cs @@ -42,14 +42,8 @@ public static string CacheFolder { if (string.IsNullOrEmpty(CacheFolderValue)) { - string envVar = "%HOME%"; - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - envVar = "%USERPROFILE%"; - } - - CacheFolderValue = Path.Combine(Environment.ExpandEnvironmentVariables(envVar), ".librarymanager", "cache"); + string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + CacheFolderValue = Path.Combine(localAppData, ".librarymanager", "cache"); } return CacheFolderValue;