mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-28 07:39:49 +08:00
Check return is not null and if so get directory info (#12763)
This commit is contained in:
parent
7f7ab5f5b1
commit
2df4b987ce
@ -27,6 +27,14 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.WorkspacesHelper
|
||||
if (typeWorkspace.TypeWorkspace.HasValue)
|
||||
{
|
||||
var folderName = Path.GetFileName(unescapeUri);
|
||||
|
||||
// Check we haven't returned '' if we have a path like C:\
|
||||
if (string.IsNullOrEmpty(folderName))
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(unescapeUri);
|
||||
folderName = dirInfo.Name.TrimEnd(':');
|
||||
}
|
||||
|
||||
return new VSCodeWorkspace()
|
||||
{
|
||||
Path = uri,
|
||||
|
Loading…
Reference in New Issue
Block a user