Skip to content

Commit 6784184

Browse files
committed
fix: truncated path display when root directory is missing
1 parent c1655db commit 6784184

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/project/WorkingSetView.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ define(function (require, exports, module) {
10031003

10041004
/**
10051005
* adds the directory name to external project files
1006-
* when the directory length is more than 3, we just show `...`
1006+
* when the directory length is more than 3, we show it in this format: `<root directory>/.../<parent directory>`
10071007
* otherwise the full path
10081008
* @private
10091009
* @param {Array.<string>} externalProjectFiles - the list of the external project files
@@ -1028,7 +1028,9 @@ define(function (require, exports, module) {
10281028

10291029
let truncatedPath = displayPath; // truncatedPath value will be shown in the UI
10301030
if (dirSplit.length > 3) {
1031-
truncatedPath = dirSplit[0] + separator + "\u2026" + separator + dirSplit[dirSplit.length - 1];
1031+
// because sometimes dirSplit[0] is empty
1032+
let rootDirName = dirSplit[0] ? dirSplit[0] : dirSplit[1];
1033+
truncatedPath = rootDirName + separator + "\u2026" + separator + dirSplit[dirSplit.length - 1];
10321034
}
10331035

10341036
const $dir = $(`<span title='${displayPath}' class='directory'/>`)

0 commit comments

Comments
 (0)