summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdir.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update year in Nokia copyright messages.Jason McDonald2012-01-111-1/+1
| | | | | | | | | Simple search and replace. This commit doesn't touch 3rd-party files, nor translations (where the change is not so simple and will be handled in a separate commit). Change-Id: I4e48513b8078a44a8cd272326685b25338890148 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* symbian - Document behaviour of QDir::rootPath / homePathShane Kearns2011-09-231-4/+6
| | | | | | | | | The root path was intentionally changed to reflect the real drive root, while home path continues to reflect the user data directory. Task-Number: QTBUG-21527 Reviewed-By: Miikka Heikkinen
* Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging into ↵Qt Continuous Integration System2011-09-101-3/+14
|\ | | | | | | | | | | | | | | | | | | | | | | master-integration * 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging: Merge fixes for QDir::operator== QSslCertificate: block all DigiNotar (intermediate and root) certs Restore Qt4.7 behaviour of QFileInfo::absolute(File)Path Fix compile error on MSVC2008 Fix comparison of absolute, unclean paths in QDir Wrap calls to Sequence::push_back
| * Merge fixes for QDir::operator==Shane Kearns2011-09-071-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | There were two fixes in 4.8 which each fixed a part of the problem. Comparing canonical paths is more correct, but is only possible where both directories exist. If neither directory exists, then compare absolute paths instead. Changed a regression test, because /tmp is a symbolic link on MacOS. I.E. "/tmp/.." is canonically "/private" and not "/" as expected. Task-Number: QTBUG-20495 Reviewed-By: joao
| * Fix comparison of absolute, unclean paths in QDirShane Kearns2011-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QDir::operator== was creating a clean absolute path for comparison purposes if the original path was relative. However original absolute paths were trusted, even though they could be unclean. Now they are checked for cleanliness first. Task-Number: QTBUG-19995 Task-Number: QTBUG-20495 Change-Id: I047a1a40ae5151e4604085e4ac87f30a4e4979c4 Reviewed-on: http://codereview.qt.nokia.com/4099 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
* | Merge remote-tracking branch 'upstream/4.8'Sergio Ahumada2011-08-291-3/+7
|\ \ | |/ | | | | | | Conflicts: tools/qdoc3/cppcodemarker.cpp
| * Revert "Don't second-guess the "engine"; call cleanPath on absolutePaths"João Abecasis2011-08-261-2/+8
| | | | | | | | | | | | This reverts commit 07afddbf4bc029f776810381c7317fffa100eb60. This breaks QDir autotests on windows.
| * Don't second-guess the "engine"; call cleanPath on absolutePathsJoão Abecasis2011-08-261-8/+2
| | | | | | | | | | | | | | | | This ensures there is a single definition of what constitutes an absolute path in Qt. Task-number: QTBUG-19995 Reviewed-by: Prasanth Ullattil
| * Compare non-canonical paths before falling back on expensive computationJoão Abecasis2011-08-261-0/+4
| | | | | | | | Reviewed-by: Prasanth Ullattil
| * Fix QDir::operator==(const QDir &) constJoão Abecasis2011-08-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | We can't rely on absolute paths when comparing directories for equality as these don't take into account symbolic links and may also bypass ../ and ./ simplification. Instead, canonical paths must be computed and can then be compared according to the case sensitivity rules for the platform or file engine, as is done in QFileInfo. Task-number: QTBUG-20495 Reviewed-by: Prasanth Ullattil
* | Replace 'i < len-1 && func(i+1)' by 'i+1 < len && func(i+1)'suzuki toshiya2011-08-181-3/+3
|/ | | | | Merge-request: 1299 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Avoid spurious detaching in QDir::to/fromNativeSeparatorsJoão Abecasis2011-08-111-10/+28
| | | | | | | | | | | | The new code avoids non-const detaching operations until needed and uses a pointer into the "raw" QChar data from then on, thus skipping unneeded checks on the reference count for further detaching. These functions are used all the time by the file system classes so this small optimization won't hurt. In particular, it will help users who already use '/' when passing paths into Qt. Reviewed-by: Peter Hartmann
* Update licenseheader text in source files for qt4.8Jyri Tahtela2011-05-131-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* QDir: Fix absolute paths when using file enginesJoão Abecasis2011-03-181-4/+11
| | | | | | | | | | | | QFileSystemEntry doesn't know about paths as implemented by custom file engines, such as is the case with resource files. In such cases, we need to allow the engine to make the relative to absolute conversion. Expanded QDir's test case to ensure resource paths are considered in more places. Task-number: QTBUG-17921 Reviewed-by: Prasanth Ullattil
* Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-01-171-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/webkit/imageanalyzer/imageanalyzer.h examples/webkit/imageanalyzer/mainwindow.h mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h src/corelib/io/qfsfileengine_iterator_unix.cpp src/corelib/io/qfsfileengine_iterator_win.cpp src/corelib/kernel/qcoreapplication.cpp src/network/access/qnetworkaccessdatabackend.cpp src/plugins/bearer/connman/qconnmanservice_linux.cpp src/plugins/platforms/openvglite/qwindowsurface_vglite.h src/s60installs/bwins/QtCoreu.def src/s60installs/eabi/QtCoreu.def src/s60installs/s60installs.pro tools/assistant/tools/assistant/helpviewer_qwv.h tools/qdoc3/test/qt-html-templates.qdocconf
| * Update copyright year to 2011.Jason McDonald2011-01-101-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | Fix QDir::relativeFilePathJoão Abecasis2010-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | We used to call cleanPath on the result of absolutePath, before returning it to the user, but stopped doing that. relativeFilePath actually depended on that and broke. Fixed now. Reviewed-by: Prasanth Ullattil
* | Let's use engine's understanding of relative pathJoão Abecasis2010-11-251-1/+3
| | | | | | | | | | | | | | | | | | | | As much as I'd like to have the definition of "relative" be independent of custom engines, the current architecture prevents us from doing that without introducing knowledge about them in QFileSystemEntry. Fixing this specifically for resource files would be possible, but let's not break custom engines... just yet. Reviewed-by: Prasanth Ullattil
* | Move QDir::fromNativeSeparators call to the QFileSystemEntry constructorShane Kearns2010-10-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | The m_filePath should always have / as the separator, while m_nativeFilePath should always have the native separator. Almost every place the constructor is used, the path could be one passed into an API from code outside our control. So it's easier to do the path conversion in the constructor than to have to remember to call fromNativeSeparators in every place a QFileSystemEntry is constructed (especially since unix tests won't reveal any error) Reviewed-By: joao
* | Fix caching of metadata in QDir to not change behaviorThomas Zander2010-10-121-3/+3
| | | | | | | | | | | | | | In 4.7 and before a QDir::exists() always stats and a refresh() call would flush metadata, restore this behavior again. Reviewed-by: Prasanth Ullattil
* | Update documentation of QDir to reflect Qt 4 behaviourShane Kearns2010-10-121-0/+6
| | | | | | | | Reviewed-By: Thomas Zander
* | Merge commit 'origin/master' into fileEnginesOn47Thomas Zander2010-09-281-0/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/Makefile.win32 qmake/qmake.pri src/corelib/io/qdir.cpp src/corelib/io/qfileinfo.cpp src/corelib/io/qfileinfo_p.h src/corelib/io/qfsfileengine_win.cpp src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtCoreu.def src/s60installs/eabi/QtGuiu.def src/tools/bootstrap/bootstrap.pro tests/auto/qfileinfo/tst_qfileinfo.cpp
| * \ Merge remote branch 'origin/4.7' into qt-master-from-4.7Thiago Macieira2010-09-211-2/+3
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.h src/declarative/graphicsitems/qdeclarativeflickable.cpp src/declarative/graphicsitems/qdeclarativeflickable_p_p.h src/declarative/util/qdeclarativelistmodel.cpp
| | * Restore 4.7.0 behavior that non-existing paths are possible.Thomas Zander2010-09-161-2/+3
| | | | | | | | | | | | | | | | | | | | | Changing a relative path to a non-existing absolute path used to work, this should work again after this patch. Reviewed-by: João Abecasis
| * | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2010-09-101-267/+212
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bin/syncqt demos/declarative/snake/content/snake.js demos/declarative/snake/snake.qml doc/src/development/qmake-manual.qdoc src/corelib/plugin/plugin.pri src/gui/kernel/qapplication_win.cpp src/gui/kernel/qdesktopwidget_win.cpp src/gui/painting/qdrawhelper.cpp tests/auto/qdir/tst_qdir.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf
| | * QDir: Removed checks for existance of fileEngineJoão Abecasis2010-09-071-49/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Directly or indirectly, all instances of QDir call QDirPrivate::setPath, which allocates a file engine and dereferences it. Any failures there should already lead to a crash or a bad_alloc exception being thrown in case of failure. Given that, QDir may be (and was) broken when compiling Qt with QT_NO_FSFILEENGINE, if no custom file engine and handler are provided. This being the case, it's pointless to check fileEngine for null all over the place. This simplifies the code and should allow for easier transition to file-engine-less implementation. Reviewed-by: Thomas Zander
| | * QDir and QFileInfo shouldn't lose properties when detachingJoão Abecasis2010-09-071-17/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For QFileInfo, the caching state was being lost on the different setFile overloads. QDir::cd and ::makeAbsolute were losing filters and sorting flags. QDir issues were introduced with these patches: "Simplify QDir::cd" "QDir::makeAbsolute could self-destruct on failure" Reviewed-by: Prasanth Ullattil
| | * Another bug-o introduced in fixing QDirPrivate refactoringJoão Abecasis2010-09-071-0/+1
| | | | | | | | | | | | Must clear file lists when changing the name filters.
| | * Reverting QDir::detach introduced earlierJoão Abecasis2010-09-071-38/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the client API it is a broken concept, because it could leave the user with an uninitialized file engine. Fixing to initialize the file engine, would mean it is useless for internal use where file engines are initialized separately. In the end, removing both the QDir::detach introduced earlier and throwing away the private d_func'tions altogether is a binary-compatible change that should allow us to push this change in a patch release (fingers crossed!) Reviewed-by: Thiago Macieira
| | * Simplify QDir::cdJoão Abecasis2010-09-071-2/+1
| | | | | | | | | | | | | | | | | | | | | Copy constructing a QDir instance from this and then detaching it in setPath doesn't get us anything so we might as well do it all in one go. Reviewed-by: Prasanth Ullattil
| | * QDir::makeAbsolute could self-destruct on failureJoão Abecasis2010-09-071-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | makeAbsolute would return false if the newly constructed file engine reported it wasn't referencing a directory. At this point, the private data has already been updated, rendering the instance unusable. Instead, we now create a separate QDir instance and reset our private data only on success. Similarly to what's done in QDir::cd. Reviewed-by: Prasanth Ullattil
| | * QDir::operator= simplificationJoão Abecasis2010-09-071-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | With the recent changes to QDirPrivate and how d_ptr is now a QSharedDataPointer, we no longer need to worry about self-assignment, as that is already handled by the d_ptr. Simplifying code here. Reviewed-by: Prasanth Ullattil
| | * QDirPrivate refactoringJoão Abecasis2010-09-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While refactoring, a bug was introduced where shared data would be updated before detaching in setNameFilter. Further refactoring turned this into a double-detach, instead. Now the issue is fixed by adding the appropriate initFileEngine and nameFilters assignment, instead of calling setNameFilters to finish the job. Reviewed-by: Thomas Zander
| | * QDirPrivate refactoringJoão Abecasis2010-09-071-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some renaming to make intent clearer and improve consistency: listsDirty => listsInitialized (logic inverted) updateFileLists => initFileLists clear => clearFileLists Also note that initializing file lists shouldn't trigger detach, because no previous version of the cached data has been seen. Reviewed-by: Thomas Zander
| | * QDirPrivate refactoringJoão Abecasis2010-09-071-25/+24
| | | | | | | | | | | | | | | | | | Moved common initialization code from QDir ctor to QDirPrivate. Reviewed-by: Thomas Zander
| | * Removed QDirPrivate layer of indirectionJoão Abecasis2010-09-071-226/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merged QDirPrivate with QDirPrivate::Data, as QDirPrivate served no purpose by itself, only adding an additional layer of indirection to the potentially shared private data, and an unnecessary allocation. Now, QDir holds a QSharedDataPointer to its private data. Private data will be shared among copied instances with COW semantics. Still, this sharing is very limited as plenty of regular use cases will cause the shared data to detach, such as refreshing the file lists. As the use QSharedDataPointer breaks usage of the Q_DECLARE_PRIVATE macro, we manually define the d_func'tions. Non-const d_func detaches on shared data. A detach function was added to the public interface to support this. (On a side note, QFileInfo already exposes a similar detach function). As much as possible, detach is handled implicitly inside the Q_D macro, through the d_func() non-const overload. On the other hand, implicit creation of file engines through detach was made explicit with a call to a new initFileEngine function. Reviewed-by: Thomas Zander
| | * Refactoring QDirPrivate::DataJoão Abecasis2010-09-071-84/+98
| | | | | | | | | | | | | | | | | | | | | | | | There was an unnecessary split of QDir's private data between QDirPrivate and QDirPrivate::Data. As a stepping stone towards merging the two, this moves everything into QDirPrivate::Data. Reviewed-by: Thomas Zander
| * | Compile bootstrapped tools with QT_NO_DEPRECATEDHarald Fernengel2010-08-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This removes extra baggage from our bootstapped tools, and also ensures that we can compile it with host-g++ on Maemo which has a problem parsing our deprecated macros inside templates. Reviewed-by: Robert Griebl
* | | Fix regression in QDir::cd()Thomas Zander2010-09-221-0/+1
| | | | | | | | | | | | | | | | | | | | | On changing path we always have to clear the metadata as thats from the old directory and we need to re-stat for the new data. Reviewed-by: João Abecasis
* | | Make QDirIterator cheaper when constructed with a QDirThomas Zander2010-09-221-128/+98
| | | | | | | | | | | | | | | | | | | | | Make sure we share the pre-calculated entry and avoid resolving the fileEngine if we know its a native FS based file. Reviewed-by: João Abecasis
* | | Move rootPath, homePath, tempPath, currentPath and setCurrentPathShane Kearns2010-09-201-26/+5
| | | | | | | | | | | | | | | | | | | | | Moved these functions inside the QFilesystemEngine and redirected the QFSFileEngine copies. Reviewed-By: joao
* | | Fix for QDir constructed with a path containing native separators.Shane Kearns2010-09-161-4/+6
| | | | | | | | | | | | | | | | | | | | | QFileSystemEntry's m_filePath should always contain a path with / as separator. Reviewed-By: Thomas Zander
* | | Make QDir use QFileSystemEngineThomas Zander2010-09-161-69/+114
| | | | | | | | | | | | | | | | | | | | | | | | The creation of a QAbstractFileEngine derived class will now be avoided if the dir we are watching is on the native file system and from then on all access will be through the direct API Reviewed-by: João Abecasis
* | | QDir: Removed checks for existance of fileEngineJoão Abecasis2010-08-311-49/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Directly or indirectly, all instances of QDir call QDirPrivate::setPath, which allocates a file engine and dereferences it. Any failures there should already lead to a crash or a bad_alloc exception being thrown in case of failure. Given that, QDir may be (and was) broken when compiling Qt with QT_NO_FSFILEENGINE, if no custom file engine and handler are provided. This being the case, it's pointless to check fileEngine for null all over the place. This simplifies the code and should allow for easier transition to file-engine-less implementation. Reviewed-by: Thomas Zander
* | | QDir and QFileInfo shouldn't lose properties when detachingJoão Abecasis2010-08-311-17/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For QFileInfo, the caching state was being lost on the different setFile overloads. QDir::cd and ::makeAbsolute were losing filters and sorting flags. QDir issues were introduced with these patches: "Simplify QDir::cd" "QDir::makeAbsolute could self-destruct on failure" Reviewed-by: Prasanth Ullattil
* | | Another bug-o introduced in fixing QDirPrivate refactoringJoão Abecasis2010-08-311-0/+1
| | | | | | | | | | | | Must clear file lists when changing the name filters.
* | | Reverting QDir::detach introduced earlierJoão Abecasis2010-08-311-38/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the client API it is a broken concept, because it could leave the user with an uninitialized file engine. Fixing to initialize the file engine, would mean it is useless for internal use where file engines are initialized separately. In the end, removing both the QDir::detach introduced earlier and throwing away the private d_func'tions altogether is a binary-compatible change that should allow us to push this change in a patch release (fingers crossed!) Reviewed-by: Thiago Macieira
* | | Simplify QDir::cdJoão Abecasis2010-08-271-2/+1
| | | | | | | | | | | | | | | | | | | | | Copy constructing a QDir instance from this and then detaching it in setPath doesn't get us anything so we might as well do it all in one go. Reviewed-by: Prasanth Ullattil
* | | QDir::makeAbsolute could self-destruct on failureJoão Abecasis2010-08-271-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | makeAbsolute would return false if the newly constructed file engine reported it wasn't referencing a directory. At this point, the private data has already been updated, rendering the instance unusable. Instead, we now create a separate QDir instance and reset our private data only on success. Similarly to what's done in QDir::cd. Reviewed-by: Prasanth Ullattil
* | | QDir::operator= simplificationJoão Abecasis2010-08-271-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | With the recent changes to QDirPrivate and how d_ptr is now a QSharedDataPointer, we no longer need to worry about self-assignment, as that is already handled by the d_ptr. Simplifying code here. Reviewed-by: Prasanth Ullattil