Skip to content

Commit 75d1b24

Browse files
kasperk81marcpopMSFT
authored andcommitted
use SpecialFolder.UserProfile in few places
1 parent 1f74ef6 commit 75d1b24

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,7 @@ public static string GetTempPath(string workingDir)
7777
}
7878
}
7979

80-
var userProfile = Environment.GetEnvironmentVariable("USERPROFILE");
81-
if (Path.IsPathRooted(userProfile))
82-
{
83-
return userProfile;
84-
}
85-
86-
return Environment.GetEnvironmentVariable("SYSTEMROOT");
80+
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
8781
}
8882

8983
public static Task<ServerResponse> RunOnServer(

0 commit comments

Comments
 (0)