diff options
| author | Christian Kandeler <christian.kandeler@digia.com> | 2013-10-11 12:11:01 +0200 |
|---|---|---|
| committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-10-14 16:19:13 +0200 |
| commit | 75d878681e71d54863d82eff4349c1f04ba73492 (patch) | |
| tree | b5b919cc7deb8c161f0773ea6e6a425512f75a37 /share | |
| parent | 8ace707d5798d4ea3506a6f73a10c99c8a7c0f54 (diff) | |
| download | qbs-75d878681e71d54863d82eff4349c1f04ba73492.tar.gz | |
Fix FileInfo.path().
Remove the trailing slash for directories if the file name is empty.
This makes sense, since repeated invocations of path() will strip off
additional components, as one would expect. It is also how
QFileInfo::path() behaves.
Change-Id: Idc28fcaba5d3a8c907b8d6ce8f55001909f00fa8
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Diffstat (limited to 'share')
| -rw-r--r-- | share/qbs/imports/qbs/FileInfo/fileinfo.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/share/qbs/imports/qbs/FileInfo/fileinfo.js b/share/qbs/imports/qbs/FileInfo/fileinfo.js index fb241f8ff..f04212f1e 100644 --- a/share/qbs/imports/qbs/FileInfo/fileinfo.js +++ b/share/qbs/imports/qbs/FileInfo/fileinfo.js @@ -1,6 +1,11 @@ function path(fp) { - if (fp[fp.length -1] === '/') + if (fp === '/') return fp; + + // Yes, this will be wrong for "clever" unix users calling their directory 'c:'. Boohoo. + if (fp.length === 3 && fp.slice(-2) === ':/') + return fp; + var last = fp.lastIndexOf('/'); if (last < 0) return '.'; |
