@@ -214,14 +214,14 @@ private static void PreStartCorrectionAfterModeChange(Settings settings)
214
214
&& ! settings . PluginSettings . PythonExecutablePath . StartsWith ( DataLocation . PortableDataPath ) )
215
215
{
216
216
settings . PluginSettings . PythonExecutablePath
217
- = GetUpdatedPortablePath ( settings . PluginSettings . PythonExecutablePath , DataLocation . PythonEnvironmentName ) ;
217
+ = GetUpdatedEnvironmentPath ( settings . PluginSettings . PythonExecutablePath ) ;
218
218
}
219
219
220
220
if ( IsUsingPortablePath ( settings . PluginSettings . NodeExecutablePath , DataLocation . NodeEnvironmentName )
221
221
&& ! settings . PluginSettings . NodeExecutablePath . StartsWith ( DataLocation . PortableDataPath ) )
222
222
{
223
223
settings . PluginSettings . NodeExecutablePath
224
- = GetUpdatedPortablePath ( settings . PluginSettings . NodeExecutablePath , DataLocation . NodeEnvironmentName ) ;
224
+ = GetUpdatedEnvironmentPath ( settings . PluginSettings . NodeExecutablePath ) ;
225
225
}
226
226
227
227
// When user has switched from roaming to portable
@@ -241,11 +241,11 @@ private static void PreStartCorrectionAfterModeChange(Settings settings)
241
241
{
242
242
if ( IsUsingPortablePath ( settings . PluginSettings . PythonExecutablePath , DataLocation . PythonEnvironmentName ) )
243
243
settings . PluginSettings . PythonExecutablePath
244
- = GetUpdatedPortablePath ( settings . PluginSettings . PythonExecutablePath , DataLocation . PythonEnvironmentName ) ;
244
+ = GetUpdatedEnvironmentPath ( settings . PluginSettings . PythonExecutablePath ) ;
245
245
246
246
if ( IsUsingPortablePath ( settings . PluginSettings . NodeExecutablePath , DataLocation . NodeEnvironmentName ) )
247
247
settings . PluginSettings . NodeExecutablePath
248
- = GetUpdatedPortablePath ( settings . PluginSettings . NodeExecutablePath , DataLocation . NodeEnvironmentName ) ;
248
+ = GetUpdatedEnvironmentPath ( settings . PluginSettings . NodeExecutablePath ) ;
249
249
}
250
250
}
251
251
@@ -261,12 +261,13 @@ private static bool IsUsingRoamingPath(string filePath)
261
261
return filePath . StartsWith ( DataLocation . RoamingDataPath ) ;
262
262
}
263
263
264
- private static string GetUpdatedPortablePath ( string filePath , string pluginEnvironmentName )
264
+ private static string GetUpdatedEnvironmentPath ( string filePath )
265
265
{
266
266
var index = filePath . IndexOf ( DataLocation . PluginEnvironments ) ;
267
- // get the substring after "Environments" because we can not determine it
268
- var updatedPath = filePath . Substring ( index + DataLocation . PluginEnvironments . Count ( ) ) ;
269
- return $ "{ DataLocation . PluginEnvironmentsPath } { updatedPath } ";
267
+
268
+ // get the substring after "Environments" because we can not determine it dynamically
269
+ var ExecutablePathSubstring = filePath . Substring ( index + DataLocation . PluginEnvironments . Count ( ) ) ;
270
+ return $ "{ DataLocation . PluginEnvironmentsPath } { ExecutablePathSubstring } ";
270
271
}
271
272
}
272
273
}
0 commit comments