fixed windows remove path function
This commit is contained in:
parent
2ccb0286da
commit
fbca09a0ca
19
flist.v
19
flist.v
@ -62,9 +62,9 @@ fn add_path_windows() {
|
|||||||
exit_code := os.system(cmd)
|
exit_code := os.system(cmd)
|
||||||
|
|
||||||
if exit_code == 0 {
|
if exit_code == 0 {
|
||||||
println('PATH updated successfully. \nMake sure to load a new admin PowerShell to use the CLI.')
|
success_message('\nFlist CLI directory added to the path. \nMake sure to load a new admin PowerShell to use the CLI.')
|
||||||
} else {
|
} else {
|
||||||
println('Failed to update the PATH. Please try running the script as an administrator.')
|
error_message('\nFailed to add the Flist CLI to the PATH. Please try running the script as an administrator.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,15 +85,15 @@ fn remove_path_windows() {
|
|||||||
new_env_path := current_path.split(';').filter(it != path_to_remove).join(';')
|
new_env_path := current_path.split(';').filter(it != path_to_remove).join(';')
|
||||||
|
|
||||||
// Prepare the command to set the new PATH
|
// Prepare the command to set the new PATH
|
||||||
cmd := 'setx PATH "${new_env_path}"'
|
cmd := r'setx PATH "' + new_env_path + '"'
|
||||||
|
|
||||||
// Execute the command to update the PATH
|
// Execute the command to update the PATH
|
||||||
exit_code := os.system(cmd.replace('"$', '${new_env_path}"'))
|
exit_code := os.system(cmd)
|
||||||
|
|
||||||
if exit_code == 0 {
|
if exit_code == 0 {
|
||||||
println('PATH updated successfully.')
|
success_message('\nThe Flist CLI directory has been removed from the path.')
|
||||||
} else {
|
} else {
|
||||||
println('Failed to update the PATH. Please try running the script as an administrator.')
|
error_message('\nFailed to remove the Flist CLI from the PATH. Please try running the script as an administrator.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,10 +164,9 @@ fn uninstall() {
|
|||||||
info_message('Flist CLI is not installed at ' + binary_location)
|
info_message('Flist CLI is not installed at ' + binary_location)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment the following block if you want to remove from PATH for Windows.
|
$if windows {
|
||||||
// if os.user_os() == 'windows' {
|
remove_path_windows()
|
||||||
// remove_path_windows()
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn login() {
|
fn login() {
|
||||||
|
Loading…
Reference in New Issue
Block a user