@@ -26,6 +26,9 @@ const (
2626 HWND_BROADCAST = 0xffff
2727 WM_SETTINGCHANGE = 0x001A
2828 SMTO_ABORTIFHUNG = 0x0002
29+
30+ // pathActionMove is used to indicate the shims directory needs to be moved to the beginning of PATH
31+ pathActionMove = "move"
2932)
3033
3134// AddToPath adds the shims directory to the System PATH on Windows.
@@ -80,7 +83,7 @@ func checkSystemPath(shimsDir string) (bool, string, error) {
8083 if foundAt == 0 {
8184 return false , "" , nil // Already at beginning
8285 } else if foundAt > 0 {
83- return true , "move" , nil // Exists but not at beginning
86+ return true , pathActionMove , nil // Exists but not at beginning
8487 }
8588 return true , "add" , nil // Not in PATH
8689}
@@ -96,7 +99,7 @@ func isAdmin() bool {
9699
97100// promptForElevation prompts the user to re-run dtvem init with admin privileges
98101func promptForElevation (shimsDir , action string ) error {
99- if action == "move" {
102+ if action == pathActionMove {
100103 ui .Header ("PATH Fix Required (Administrator)" )
101104 ui .Warning ("%s is in your System PATH but not at the beginning" , shimsDir )
102105 ui .Info ("It needs to be first to take priority over other installations" )
@@ -196,7 +199,7 @@ func modifySystemPath(shimsDir, action string) error {
196199 // Broadcast WM_SETTINGCHANGE to notify running processes
197200 broadcastSettingChange ()
198201
199- if action == "move" {
202+ if action == pathActionMove {
200203 ui .Success ("Moved %s to the beginning of your System PATH" , shimsDir )
201204 } else {
202205 ui .Success ("Added %s to your System PATH" , shimsDir )
0 commit comments