[PT Run][VSCodeWorkspaces] Do not check WSL paths existence (#31351)

This commit is contained in:
Stefan Markovic
2024-02-08 15:15:49 +01:00
committed by GitHub
parent 04f5147cde
commit dec535e4c4

View File

@@ -46,7 +46,7 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.WorkspacesHelper
path = path[1..]; path = path[1..];
} }
if (!DoesPathExist(path, workspaceEnv.Value, machineName)) if (!DoesPathExist(path, workspaceEnv.Value))
{ {
return null; return null;
} }
@@ -72,18 +72,11 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.WorkspacesHelper
}; };
} }
private bool DoesPathExist(string path, WorkspaceEnvironment workspaceEnv, string machineName) private bool DoesPathExist(string path, WorkspaceEnvironment workspaceEnv)
{ {
if (workspaceEnv == WorkspaceEnvironment.Local || workspaceEnv == WorkspaceEnvironment.RemoteWSL) if (workspaceEnv == WorkspaceEnvironment.Local)
{ {
var resolvedPath = path; return Directory.Exists(path) || File.Exists(path);
if (workspaceEnv == WorkspaceEnvironment.RemoteWSL)
{
resolvedPath = $"\\\\wsl$\\{machineName}{resolvedPath.Replace('/', '\\')}";
}
return Directory.Exists(resolvedPath) || File.Exists(resolvedPath);
} }
// If the workspace environment is not Local or WSL, assume the path exists // If the workspace environment is not Local or WSL, assume the path exists