diff --git a/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs b/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs
index 4ffbc0347..21b16c899 100644
--- a/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs
+++ b/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs
@@ -157,56 +157,13 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
}
}
- public static void IndicatePluginEnvPathsUpdate(Settings settings, string newVer)
- {
- var appVer = $"app-{newVer}";
- var updatePythonIndicatorFilePath
- = Regex.Replace(Path.Combine(DataLocation.PluginEnvironments, updatePythonIndicatorFilename), appDataRegex, appVer);
- var updateNodeIndicatorFilePath
- = Regex.Replace(Path.Combine(DataLocation.PluginEnvironments, updateNodeIndicatorFilename), appDataRegex, appVer);
-
- if (!string.IsNullOrEmpty(settings.PluginSettings.PythonExecutablePath)
- && settings.PluginSettings.PythonExecutablePath.StartsWith(DataLocation.PluginEnvironments))
- using (var _ = File.CreateText(updatePythonIndicatorFilePath)) { }
-
- if (!string.IsNullOrEmpty(settings.PluginSettings.NodeExecutablePath)
- && settings.PluginSettings.NodeExecutablePath.StartsWith(DataLocation.PluginEnvironments))
- using (var _ = File.CreateText(updateNodeIndicatorFilePath)) { }
- }
-
+ ///
+ /// After app updated while in portable mode or switched between portable/roaming mode,
+ /// need to update each plugin's executable path so user will not be prompted again to reinstall the environments.
+ ///
+ ///
public static void PreStartPluginFilePathCorrection(Settings settings)
{
- PreStartCorrectionAfterUpdate(settings);
- PreStartCorrectionAfterModeChange(settings);
- }
-
- private static void PreStartCorrectionAfterUpdate(Settings settings)
- {
- // After updating flow, update plugin env paths.
- var appVer = $"app-{Constant.Version}";
- var updatePythonIndicatorFilePath = Path.Combine(DataLocation.PluginEnvironments, updatePythonIndicatorFilename);
- var updateNodeIndicatorFilePath = Path.Combine(DataLocation.PluginEnvironments, updateNodeIndicatorFilename);
-
- if (File.Exists(updatePythonIndicatorFilePath))
- {
- settings.PluginSettings.PythonExecutablePath
- = Regex.Replace(settings.PluginSettings.PythonExecutablePath, appDataRegex, appVer);
-
- File.Delete(updatePythonIndicatorFilePath);
- }
-
- if (File.Exists(updateNodeIndicatorFilePath))
- {
- settings.PluginSettings.NodeExecutablePath
- = Regex.Replace(settings.PluginSettings.NodeExecutablePath, appDataRegex, appVer);
-
- File.Delete(updateNodeIndicatorFilePath);
- }
- }
-
- private static void PreStartCorrectionAfterModeChange(Settings settings)
- {
- // After enabling/disabling portable mode, update plugin env paths.
if (DataLocation.PortableDataLocationInUse())
{
// When user is using portable but has moved flow to a different location
@@ -251,6 +208,8 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
private static bool IsUsingPortablePath(string filePath, string pluginEnvironmentName)
{
+ // DataLocation.PortableDataPath returns the current portable path, this determines if an out
+ // of date path is also a portable path.
var portableAppEnvLocation = $"UserData\\{DataLocation.PluginEnvironments}\\{pluginEnvironmentName}";
return filePath.Contains(portableAppEnvLocation);
diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs
index 882cabb2d..a0baa51ba 100644
--- a/Flow.Launcher.Core/Updater.cs
+++ b/Flow.Launcher.Core/Updater.cs
@@ -17,7 +17,6 @@ using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using System.Text.Json.Serialization;
using System.Threading;
-using Flow.Launcher.Core.ExternalPlugins.Environments;
namespace Flow.Launcher.Core
{
@@ -32,7 +31,7 @@ namespace Flow.Launcher.Core
private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1);
- public async Task UpdateAppAsync(IPublicAPI api, Settings settings, bool silentUpdate = true)
+ public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true)
{
await UpdateLock.WaitAsync();
try
@@ -74,8 +73,6 @@ namespace Flow.Launcher.Core
MessageBox.Show(string.Format(api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"),
DataLocation.PortableDataPath,
targetDestination));
-
- AbstractPluginEnvironment.IndicatePluginEnvPathsUpdate(settings, newReleaseVersion.ToString());
}
else
{
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index c35727b36..dee023599 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -138,12 +138,12 @@ namespace Flow.Launcher
var timer = new Timer(1000 * 60 * 60 * 5);
timer.Elapsed += async (s, e) =>
{
- await _updater.UpdateAppAsync(API, _settings);
+ await _updater.UpdateAppAsync(API);
};
timer.Start();
// check updates on startup
- await _updater.UpdateAppAsync(API, _settings);
+ await _updater.UpdateAppAsync(API);
}
});
}
diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
index 69c5fd40f..5514951b1 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -68,7 +68,7 @@ namespace Flow.Launcher.ViewModel
public async void UpdateApp()
{
- await _updater.UpdateAppAsync(App.API, Settings, false);
+ await _updater.UpdateAppAsync(App.API, false);
}
public bool AutoUpdates