|
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | 6 | 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'; |
8 | 8 | import { endsWith, startsWithIgnoreCase, rtrim, startsWith } from 'vs/base/common/strings'; |
9 | 9 | import { Schemas } from 'vs/base/common/network'; |
10 | 10 | import { isLinux, isWindows, isMacintosh } from 'vs/base/common/platform'; |
@@ -387,8 +387,12 @@ export function unmnemonicLabel(label: string): string { |
387 | 387 | * Splits a path in name and parent path, supporting both '/' and '\' |
388 | 388 | */ |
389 | 389 | 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 }; |
392 | 395 | } |
393 | | - return { name: path_basename(fullPath), parentPath: path_dirname(fullPath) }; |
| 396 | + // only the root segment |
| 397 | + return { name: parentPath, parentPath: '' }; |
394 | 398 | } |
0 commit comments