Skip to content

Commit 715cdf7

Browse files
committed
Empty links in recent workspaces list. FIxes microsoft#74363
1 parent fd21336 commit 715cdf7

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/vs/base/common/labels.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { URI } from 'vs/base/common/uri';
7-
import { sep, posix, normalize, basename as path_basename, dirname as path_dirname } from 'vs/base/common/path';
7+
import { sep, posix, normalize, win32 } from 'vs/base/common/path';
88
import { endsWith, startsWithIgnoreCase, rtrim, startsWith } from 'vs/base/common/strings';
99
import { Schemas } from 'vs/base/common/network';
1010
import { isLinux, isWindows, isMacintosh } from 'vs/base/common/platform';
@@ -387,8 +387,12 @@ export function unmnemonicLabel(label: string): string {
387387
* Splits a path in name and parent path, supporting both '/' and '\'
388388
*/
389389
export function splitName(fullPath: string): { name: string, parentPath: string } {
390-
if (fullPath.indexOf('/') !== -1) {
391-
return { name: posix.basename(fullPath), parentPath: posix.dirname(fullPath) };
390+
const p = fullPath.indexOf('/') !== -1 ? posix : win32;
391+
const name = p.basename(fullPath);
392+
const parentPath = p.dirname(fullPath);
393+
if (name.length) {
394+
return { name, parentPath };
392395
}
393-
return { name: path_basename(fullPath), parentPath: path_dirname(fullPath) };
396+
// only the root segment
397+
return { name: parentPath, parentPath: '' };
394398
}

0 commit comments

Comments
 (0)