diff --git a/flist.v b/flist.v index 5ffe45c..14c8850 100644 --- a/flist.v +++ b/flist.v @@ -56,15 +56,15 @@ fn add_path_windows() { new_env_path := '${current_path};${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 - exit_code := os.system(cmd.replace('"$', '${new_env_path}"')) + exit_code := os.system(cmd) if exit_code == 0 { - println('PATH updated successfully.') + success_message('\nFlist CLI directory added to the path. \nMake sure to load a new admin PowerShell to use the CLI.') } 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(';') // 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 - exit_code := os.system(cmd.replace('"$', '${new_env_path}"')) + exit_code := os.system(cmd) if exit_code == 0 { - println('PATH updated successfully.') + success_message('\nThe Flist CLI directory has been removed from the path.') } 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) } - // Uncomment the following block if you want to remove from PATH for Windows. - // if os.user_os() == 'windows' { - // remove_path_windows() - // } + $if windows { + remove_path_windows() + } } fn login() {