Skip to content

Commit 456aa42

Browse files
authored
use SpecialFolder.UserProfile in few places (#43826)
2 parents 1aeacc5 + 1cd69f3 commit 456aa42

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Cli/Microsoft.TemplateEngine.Cli/Commands/CliPathInfo.cs

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ private static string GetUserProfileDir(IEnvironment environment) => environment
4242
RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
4343
? "USERPROFILE"
4444
: "HOME")
45+
?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
4546
?? throw new NotSupportedException("HOME or USERPROFILE environment variable is not defined, the environment is not supported");
4647

4748
private static string GetGlobalSettingsDir(string? settingsLocation)

src/RazorSdk/Tool/ServerProtocol/ServerConnection.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static string GetTempPath(string workingDir)
7777
}
7878
}
7979

80-
var userProfile = Environment.GetEnvironmentVariable("USERPROFILE");
80+
var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
8181
if (Path.IsPathRooted(userProfile))
8282
{
8383
return userProfile;

0 commit comments

Comments
 (0)