Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.8.0, 5.3.0
-
Windows 7
-
eedefa28bd66123f7787e989a4e4bccbb09f20bc
Description
The following code:
int main() { QDir dir("NotYetCreatedDirectory"); qDebug() << dir.absolutePath(); bool result = dir.cdUp(); qDebug() << result; // false qDebug() << dir.absolutePath(); return 0; }
When run on Windows with a non-existent directory, the call to cdUp returns true and the subsequent call to absolutePath() moves up on directory.
When called on Linux with a non-existent directory, the call to cdUp is false, and the second call to absolutePath does not move up one level.
When called on Linux with an existing directory, the call to cdUp returns true and the subsequent call to absolutePath has moved up one level.
Internally, the cdUp call is calling a cd("NotYetCreatedDirectory/.."), and, as this directory does not exist, the call to "NYCD/.." also fails. Whilst this is correct from the point of view on the Linux file-system, this is not expected behavior.
I've tested this on 4.8.0 and 5.3.0, and it's the same in both, and presumably most of the versions in between.
Attachments
Issue Links
- depends on
-
QTBUG-23892 QDir::cleanPath of "dir/.." is wrong.
- Closed
For Gerrit Dashboard: QTBUG-40067 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
89464,5 | tst_qdir: Move QFINDTESTDATA() from init() to constructor. | 5.3 | qt/qtbase | Status: MERGED | +2 | 0 |
95130,2 | Standardize behavior for QDir::cdUp on Windows, OS X and Linux. | 5.3 | qt/qtbase | Status: ABANDONED | -2 | 0 |
95212,26 | Refactored qt_normalizePathSegments | 5.4 | qt/qtbase | Status: MERGED | +2 | 0 |