提交 715cdf7c 编写于 作者: M Martin Aeschlimann

Empty links in recent workspaces list. FIxes #74363

上级 fd213369
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import { sep, posix, normalize, basename as path_basename, dirname as path_dirname } from 'vs/base/common/path';
import { sep, posix, normalize, win32 } from 'vs/base/common/path';
import { endsWith, startsWithIgnoreCase, rtrim, startsWith } from 'vs/base/common/strings';
import { Schemas } from 'vs/base/common/network';
import { isLinux, isWindows, isMacintosh } from 'vs/base/common/platform';
......@@ -387,8 +387,12 @@ export function unmnemonicLabel(label: string): string {
* Splits a path in name and parent path, supporting both '/' and '\'
*/
export function splitName(fullPath: string): { name: string, parentPath: string } {
if (fullPath.indexOf('/') !== -1) {
return { name: posix.basename(fullPath), parentPath: posix.dirname(fullPath) };
const p = fullPath.indexOf('/') !== -1 ? posix : win32;
const name = p.basename(fullPath);
const parentPath = p.dirname(fullPath);
if (name.length) {
return { name, parentPath };
}
return { name: path_basename(fullPath), parentPath: path_dirname(fullPath) };
// only the root segment
return { name: parentPath, parentPath: '' };
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册