提交 a60a2472 编写于 作者: B Benjamin Pasero

Tab labels fail to identify "~" as a root path (fixes #32701)

上级 ad42ab67
......@@ -110,6 +110,7 @@ export function tildify(path: string, userHome: string): string {
*/
const ellipsis = '\u2026';
const unc = '\\\\';
const home = '~';
export function shorten(paths: string[]): string[] {
const shortenedPaths: string[] = new Array(paths.length);
......@@ -130,7 +131,7 @@ export function shorten(paths: string[]): string[] {
match = true;
// trim for now and concatenate unc path (e.g. \\network) or root path (/etc) later
// trim for now and concatenate unc path (e.g. \\network) or root path (/etc, ~/etc) later
let prefix = '';
if (path.indexOf(unc) === 0) {
prefix = path.substr(0, path.indexOf(unc) + unc.length);
......@@ -138,6 +139,9 @@ export function shorten(paths: string[]): string[] {
} else if (path.indexOf(nativeSep) === 0) {
prefix = path.substr(0, path.indexOf(nativeSep) + nativeSep.length);
path = path.substr(path.indexOf(nativeSep) + nativeSep.length);
} else if (path.indexOf(home) === 0) {
prefix = path.substr(0, path.indexOf(home) + home.length);
path = path.substr(path.indexOf(home) + home.length);
}
// pick the first shortest subpath found
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册