mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
Check return is not null and if so get directory info (#12763)
This commit is contained in:
@@ -27,6 +27,14 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.WorkspacesHelper
|
|||||||
if (typeWorkspace.TypeWorkspace.HasValue)
|
if (typeWorkspace.TypeWorkspace.HasValue)
|
||||||
{
|
{
|
||||||
var folderName = Path.GetFileName(unescapeUri);
|
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()
|
return new VSCodeWorkspace()
|
||||||
{
|
{
|
||||||
Path = uri,
|
Path = uri,
|
||||||
|
|||||||
Reference in New Issue
Block a user