@@ -157,56 +157,13 @@ private string GetFileFromDialog(string title, string filter = "")
157
157
}
158
158
}
159
159
160
- public static void IndicatePluginEnvPathsUpdate ( Settings settings , string newVer )
161
- {
162
- var appVer = $ "app-{ newVer } ";
163
- var updatePythonIndicatorFilePath
164
- = Regex . Replace ( Path . Combine ( DataLocation . PluginEnvironments , updatePythonIndicatorFilename ) , appDataRegex , appVer ) ;
165
- var updateNodeIndicatorFilePath
166
- = Regex . Replace ( Path . Combine ( DataLocation . PluginEnvironments , updateNodeIndicatorFilename ) , appDataRegex , appVer ) ;
167
-
168
- if ( ! string . IsNullOrEmpty ( settings . PluginSettings . PythonExecutablePath )
169
- && settings . PluginSettings . PythonExecutablePath . StartsWith ( DataLocation . PluginEnvironments ) )
170
- using ( var _ = File . CreateText ( updatePythonIndicatorFilePath ) ) { }
171
-
172
- if ( ! string . IsNullOrEmpty ( settings . PluginSettings . NodeExecutablePath )
173
- && settings . PluginSettings . NodeExecutablePath . StartsWith ( DataLocation . PluginEnvironments ) )
174
- using ( var _ = File . CreateText ( updateNodeIndicatorFilePath ) ) { }
175
- }
176
-
160
+ /// <summary>
161
+ /// After app updated while in portable mode or switched between portable/roaming mode,
162
+ /// need to update each plugin's executable path so user will not be prompted again to reinstall the environments.
163
+ /// </summary>
164
+ /// <param name="settings"></param>
177
165
public static void PreStartPluginFilePathCorrection ( Settings settings )
178
166
{
179
- PreStartCorrectionAfterUpdate ( settings ) ;
180
- PreStartCorrectionAfterModeChange ( settings ) ;
181
- }
182
-
183
- private static void PreStartCorrectionAfterUpdate ( Settings settings )
184
- {
185
- // After updating flow, update plugin env paths.
186
- var appVer = $ "app-{ Constant . Version } ";
187
- var updatePythonIndicatorFilePath = Path . Combine ( DataLocation . PluginEnvironments , updatePythonIndicatorFilename ) ;
188
- var updateNodeIndicatorFilePath = Path . Combine ( DataLocation . PluginEnvironments , updateNodeIndicatorFilename ) ;
189
-
190
- if ( File . Exists ( updatePythonIndicatorFilePath ) )
191
- {
192
- settings . PluginSettings . PythonExecutablePath
193
- = Regex . Replace ( settings . PluginSettings . PythonExecutablePath , appDataRegex , appVer ) ;
194
-
195
- File . Delete ( updatePythonIndicatorFilePath ) ;
196
- }
197
-
198
- if ( File . Exists ( updateNodeIndicatorFilePath ) )
199
- {
200
- settings . PluginSettings . NodeExecutablePath
201
- = Regex . Replace ( settings . PluginSettings . NodeExecutablePath , appDataRegex , appVer ) ;
202
-
203
- File . Delete ( updateNodeIndicatorFilePath ) ;
204
- }
205
- }
206
-
207
- private static void PreStartCorrectionAfterModeChange ( Settings settings )
208
- {
209
- // After enabling/disabling portable mode, update plugin env paths.
210
167
if ( DataLocation . PortableDataLocationInUse ( ) )
211
168
{
212
169
// When user is using portable but has moved flow to a different location
@@ -251,6 +208,8 @@ private static void PreStartCorrectionAfterModeChange(Settings settings)
251
208
252
209
private static bool IsUsingPortablePath ( string filePath , string pluginEnvironmentName )
253
210
{
211
+ // DataLocation.PortableDataPath returns the current portable path, this determines if an out
212
+ // of date path is also a portable path.
254
213
var portableAppEnvLocation = $ "UserData\\ { DataLocation . PluginEnvironments } \\ { pluginEnvironmentName } ";
255
214
256
215
return filePath . Contains ( portableAppEnvLocation ) ;
0 commit comments