From 6d41f9d04379d5ae982925214fe497e3635a3ee4 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Mon, 22 Aug 2016 21:53:44 +0200 Subject: [PATCH] Fallback to System.Environment.SpecialFolder.LocalApplicationData - references #1863 --- src/Paket.Core/Constants.fs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Paket.Core/Constants.fs b/src/Paket.Core/Constants.fs index 45d187c922..8ec25f3cd0 100644 --- a/src/Paket.Core/Constants.fs +++ b/src/Paket.Core/Constants.fs @@ -34,14 +34,20 @@ let AppDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.Ap let PaketConfigFolder = Path.Combine(AppDataFolder, "Paket") let PaketConfigFile = Path.Combine(PaketConfigFolder, "paket.config") -let UserProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) -let GitRepoCacheFolder = Path.Combine(UserProfile,".paket","git","db") +let LocalRootForTempData = + let userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + if String.IsNullOrWhiteSpace userProfile then + Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + else + userProfile + +let GitRepoCacheFolder = Path.Combine(LocalRootForTempData,".paket","git","db") let [] GlobalPackagesFolderEnvironmentKey = "NUGET_PACKAGES" let UserNuGetPackagesFolder = let path = Environment.GetEnvironmentVariable(GlobalPackagesFolderEnvironmentKey) if String.IsNullOrEmpty path then - Path.Combine(UserProfile,".nuget","packages") + Path.Combine(LocalRootForTempData,".nuget","packages") else path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)