summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdir.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* | | QDirPrivate refactoringJoão Abecasis2010-08-251-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-08-251-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-08-251-25/+24
| | | | | | | | | | | | | | | | | | Moved common initialization code from QDir ctor to QDirPrivate. Reviewed-by: Thomas Zander
* | | Removed QDirPrivate layer of indirectionJoão Abecasis2010-08-251-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-08-241-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
* | Fix QDir::tempPath() documentation for UnixJan Arne Petersen2010-06-241-1/+2
|/ | | | | | | Mention TMPDIR environment variable for Linux/Unix case and clarify documentation. Fixes: QTBUG-11496
* Fix regression on SymbianShane Kearns2010-03-311-1/+1
| | | | | | | | commit c43400792b637c744ca840a4ecb339ffdb27c604 made "x:/" a root directory only on windows. It should be a root on symbian too. Reviewed-by: mread
* Split QDir::NoDotAndDotDot into QDir::NoDot and QDir::NoDotDotBernhard Rosenkraenzer2010-03-231-1/+5
| | | | | | | | This creates QDir::NoDot and QDir::NoDotDot filters -- in many cases, one may want the .. entry (e.g. to navigate to the parent directory) but not the . entry (useless for navigation). Reviewed-by: Benjamin Poulain <benjamin.poulain@nokia.com>
* Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into master-s60axis2010-02-261-3/+4
|\ | | | | | | | | | | Conflicts: qmake/generators/symbian/initprojectdeploy_symbian.cpp qmake/generators/symbian/symmake_abld.h
| * doc: Added \obsolete.Martin Smith2010-02-231-4/+4
| | | | | | | | Task: QTBUG-8083
* | Fix bug in QDirPrivate::setPath, affecting QDir::cd, cdUp and setPathJoão Abecasis2010-02-111-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | The changes introduced in 9d713d7e73a88fe8328b55d2ab9af8c215dcb89d made QDirPrivate rely on the order of sub-expression evaluation. In some platform/compiler combinations, the instance of QDirPrivate::Data::path being changed would be the pre-detach one. With this change, that commit is partially reverted. Also, inlined the code in initFileEngine since this makes the actions therein explicit. Reviewed-by: Olivier Goffart
* | QDir fix issues with (shared) cached listsJoão Abecasis2010-02-031-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With 2964718224c0ed356511335742368d4fc421c6bd, QDir started really using the cached file lists. However, these were not being properly updated on setNameFilters, setFilter and setSorting. QDir::refresh, on the other hand, would invalidate the lists without first detaching, thus breaking the copy-on-write promise. Summarizing, shared data must be detached and cached lists invalidated, so they get regenerated. Reviewed-by: Olivier Goffart Reviewed-by: Ritt Konstantin
* | nano-optimizationsRitt Konstantin2010-01-291-10/+4
| | | | | | | | | | Merge-request: 445 Reviewed-by: João Abecasis <joao@trolltech.com>
* | code cleanup and styling fixesRitt Konstantin2010-01-291-157/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | * remove trailing whitespaces * tabs -> whitespaces * "if(" -> "if (" * "while(" -> "while (" * "for(" -> "for (" * "for (int i.*; i++)" -> "for (int i.*; ++i)" /* looks better ;) */ * minor doc fixes Merge-request: 445 Reviewed-by: João Abecasis <joao@trolltech.com>