提交 77b92033 编写于 作者: M Martin Aeschlimann

Recent Workspaces list broken with UNC paths and root of a drive. Fixes #74362

上级 acdbc65f
......@@ -4,12 +4,11 @@
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import { sep, posix, normalize } from 'vs/base/common/path';
import { sep, posix, normalize, basename as path_basename, dirname as path_dirname } 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';
import { isEqual, basename, relativePath } from 'vs/base/common/resources';
import { CharCode } from 'vs/base/common/charCode';
export interface IWorkspaceFolderProvider {
getWorkspaceFolder(resource: URI): { uri: URI, name?: string } | null;
......@@ -388,11 +387,8 @@ 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 } {
for (let i = fullPath.length - 1; i >= 1; i--) {
const code = fullPath.charCodeAt(i);
if (code === CharCode.Slash || code === CharCode.Backslash) {
return { parentPath: fullPath.substr(0, i), name: fullPath.substr(i + 1) };
}
if (fullPath.indexOf('/') !== -1) {
return { name: posix.basename(fullPath), parentPath: posix.dirname(fullPath) };
}
return { parentPath: '', name: fullPath };
return { name: path_basename(fullPath), parentPath: path_dirname(fullPath) };
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册