- Notifications
You must be signed in to change notification settings - Fork1.2k
Add Windows admin PATH management commands to dotnetup#52181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:release/dnup
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
a86586f542c866d8fed6a374d46e6174dec3d163b555853511d91179bbd3d5cf4e92788aa862fbd56b89532dcd0b182662File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Extract PATH splitting logic to SplitPath helper method- Remove extra blank lines in WindowsPathHelper.cs- All tests still passCo-authored-by: dsplaisted <145043+dsplaisted@users.noreply.github.com>
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -97,12 +97,20 @@ public static List<string> GetProgramFilesDotnetPaths() | ||
| return paths; | ||
| } | ||
| /// <summary> | ||
| /// Splits a PATH string into entries. | ||
| /// </summary> | ||
| private static List<string> SplitPath(string path) | ||
| { | ||
| return path.Split(';', StringSplitOptions.RemoveEmptyEntries).ToList(); | ||
| } | ||
| /// <summary> | ||
| /// Removes the Program Files dotnet path from the given PATH string. | ||
| /// </summary> | ||
| public static string RemoveProgramFilesDotnetFromPath(string path) | ||
| ||
| { | ||
| var pathEntries =SplitPath(path); | ||
| var programFilesDotnetPaths = GetProgramFilesDotnetPaths(); | ||
| // Remove entries that match Program Files dotnet paths (case-insensitive) | ||
| @@ -121,7 +129,7 @@ public static string RemoveProgramFilesDotnetFromPath(string path) | ||
| /// </summary> | ||
| public static string AddProgramFilesDotnetToPath(string path) | ||
| ||
| { | ||
| var pathEntries =SplitPath(path); | ||
| var programFilesDotnetPaths = GetProgramFilesDotnetPaths(); | ||
| // Get the primary Program Files dotnet path (non-x86) | ||
| @@ -153,7 +161,7 @@ public static string AddProgramFilesDotnetToPath(string path) | ||
| public static bool AdminPathContainsProgramFilesDotnet() | ||
| { | ||
| var adminPath = ReadAdminPath(); | ||
| var pathEntries =SplitPath(adminPath); | ||
| var programFilesDotnetPaths = GetProgramFilesDotnetPaths(); | ||
| return pathEntries.Any(entry => | ||
| @@ -190,8 +198,6 @@ public static void LogPathChange(string operation, string oldPath, string newPat | ||
| } | ||
| } | ||
| /// <summary> | ||
| /// Broadcasts a WM_SETTINGCHANGE message to notify other applications that the environment has changed. | ||
| /// </summary> | ||