From fd2a4c285310d13b2448f90e46787ebcdb41d484 Mon Sep 17 00:00:00 2001 From: mik-tf Date: Fri, 11 Oct 2024 02:33:45 -0400 Subject: [PATCH 1/3] test simpler strings for windows path --- flist.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flist.v b/flist.v index 5ffe45c..4df705d 100644 --- a/flist.v +++ b/flist.v @@ -56,10 +56,10 @@ 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.') From 2ccb0286da5fd5ccf5bd12c072b0bb5ec9b2e15e Mon Sep 17 00:00:00 2001 From: Mik-TF Date: Thu, 10 Oct 2024 23:44:48 -0700 Subject: [PATCH 2/3] added info --- flist.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flist.v b/flist.v index 4df705d..1df2ab9 100644 --- a/flist.v +++ b/flist.v @@ -62,7 +62,7 @@ fn add_path_windows() { exit_code := os.system(cmd) if exit_code == 0 { - println('PATH updated successfully.') + println('PATH updated successfully. \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.') } From fbca09a0ca9250d1338bf4693ebfdacb9369017d Mon Sep 17 00:00:00 2001 From: Mik-TF Date: Fri, 11 Oct 2024 00:07:30 -0700 Subject: [PATCH 3/3] fixed windows remove path function --- flist.v | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/flist.v b/flist.v index 1df2ab9..14c8850 100644 --- a/flist.v +++ b/flist.v @@ -62,9 +62,9 @@ fn add_path_windows() { exit_code := os.system(cmd) 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 { - 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() {