summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qtemporarydir.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Bootstrap: remove QTemporaryFileThiago Macieira2024-03-131-2/+2
| | | | | | | | | Done by harmonizing the use on the QT_CONFIG(temporaryfile) macro and fixing one test that was missing. We can't remove the older macro because it is marked PBULIC) but we don't need to use it ourselves. Change-Id: I01ec3c774d9943adb903fffd17b7eb4dd1a4e63f Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Port to QDirListingAhmad Samir2024-03-031-1/+0
| | | | | | | | | | | Use QDirListing in the Bootstrap build instead of QDirIterator. Drive-by changes: - more const variables - use emplace_back() instead of append() where appropriate Change-Id: Ie1f0d03856e557c4bfabfff38a87edc7da86d091 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove redundant QPair includesAhmad Samir2023-09-061-1/+0
| | | | | | | | Nothing in those files uses QPair; and a local build finished fine without them. Task-number: QTBUG-115841 Change-Id: I669cfecaa9129bce6b31e464826287f138b159db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtCore: replace QLatin1String/QLatin1Char with _L1/u'' where applicableSona Kurazyan2022-03-251-4/+6
| | | | | | | | | | | As a drive-by, did also minor refactorings/improvements. Task-number: QTBUG-98434 Change-Id: I81964176ae2f07ea63674c96f47f9c6aa046854f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* Enable move semantics for QTemporaryDirLuca Di Sera2022-03-181-2/+44
| | | | | | | | | | | | | | | | | Add move constructor and move assignment operator. To allow for the the change to be implemented QTemporaryDir, the internal d_ptr was modified from a QScopedPointer, which is not movable, to a raw pointer. Add member + free swap implementations. Add tests. [ChangeLog][QtCore][QTemporaryDir] Enabled move semantics. Change-Id: I9f196a77c70b4ca0b7f0c06505d00fdd87a9785c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QTemporaryDir: Set directory permissions at the time of creationIevgenii Meshcheriakov2021-11-261-11/+3
| | | | | | | | | | | Use new QDir::mkdir() method to set directory permissions at the time of its creation on systems that support this feature. This removes the time window when the created directory is potentially accessible to everybody. Task-number: QTBUG-79750 Change-Id: I82afee7f0708bfdcc9b3b3978af9a2aef1b8672d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QTemporaryDir to the bootstrap libraryMartin Smith2017-09-121-3/+3
| | | | | | | | | | | | | clang-qdoc must be compilable using the bootstrap library, but clang-qdoc uses QTemporaryDir, which is not there. This change adds it. This also required changing some camelcase includes to their lower case equivalents. Change-Id: I8d03864f56e4bf474c3fdcde5e744ed31fea7fc3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* Long live QTemporaryFileName!Thiago Macieira2017-08-041-70/+13
| | | | | | | | | | | So we can use it in QTemporaryFile, QTemporaryDir and QFile::rename() [ChangeLog][QtCore][QTemporaryDir] The class now supports the "XXXXXX" replacement token anywhere in the template, not just at the end. This behavior is similar to what QTemporaryFile supports. Change-Id: I1eba2b016de74620bfc8fffd14ccb645729de170 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Do not abbreviate directory in documentationKai Koehne2017-05-041-5/+5
| | | | | | Change-Id: I26e8c5caca31e842adc7a09151b6de2cc17698ed Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* doc: Fix the release in which QTemporaryDir::filePath() was addedAlexander Volkov2016-09-061-1/+1
| | | | | | | | Initially it was planned to introduce it in 5.8, but actually it was introduced in 5.9. Change-Id: I9101a78fa4c17572982571bac37a8fce00e86d01 Reviewed-by: David Faure <david.faure@kdab.com>
* Add a convenience function QTemporaryDir::filePath()Alexander Volkov2016-09-051-0/+27
| | | | | | | | | | | It allows to write more readable code: QString filePath = tmpDir.filePath(fileName); instead of QString filePath = tmpDir.path() + QLatin1Char('/') + fileName; Change-Id: I85aa54fd365e3bdd3ca41018ead7ed8741352b16 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-261-22/+30
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qtemporarydir.cpp One side encapsulated a repeated piece of #if-ery in a local define; the other added to the #if-ery. Made its addition to the other's. src/corelib/kernel/qeventdispatcher_unix_p.h One side moved some members into a struct; this collided with a #undef check that neither side now has. Discarded the #undef part. src/gui/opengl/qopengltexturehelper_p.h 5.7 deleted a bunch of methods; not clear why merge got confused. src/tools/moc/moc.cpp One added a name to the copyright header; another changed its URL. Change-Id: I9e9032b819f030d67f1915445acf2793e98713fa
| * Fix QTemporaryDir to handle Unicode characters on WindowsFriedemann Kleint2016-07-201-22/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For platforms not providing mkdtemp(), QTemporaryDir relied on an implementation of q_mkdtemp() operating on char *, converting back and forth using QFile::encodeName()/decodeName() when passing the name to QFileSystemEngine. This caused failures on Windows (which uses "System"/Latin1 encoding) for names containing characters outside the Latin1 space. Reimplement q_mkdtemp() to operate on QString, which avoids the conversions altogether and also enables the use of larger character spaces for the pattern. Add tests. Task-number: QTBUG-54810 Change-Id: Ie4323ad73b5beb8a1b8ab81425f73d03c626d58a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Use portable temporary directory implementation for Q_OS_INTEGRITY.Rolland Dudemaine2015-12-041-2/+2
|/ | | | | Change-Id: I667dece31d6b60e67363d7b2cc26fdd0621641a8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix build without PCH after commit 3ae2387f375798a983b6d052723f10fc88b63da0Simon Hausmann2015-10-021-0/+4
| | | | | | | Include errno.h for errno and EEXIST. Change-Id: Id28d5a08097319eb84b1fe9ef20c9be6ebe575fa Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* QTemporaryDir: fail early if the error isn't EEXISTThiago Macieira2015-08-011-0/+9
| | | | | | | | | | | | | | | | | | | | | | Before, stat -c on Linux (enabling this code path): % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 0.00 0.000000 0 256 256 mkdir After: 0.00 0.000000 0 1 1 mkdir “To err is human, to persist in error is diabolical” - Georges Canguilhem “The definition of insanity is repeating the same mistakes over and over again and expecting different results.” - Albert Einstein, Mark Twain or Benjamin Franklin (all mis-attributed) Change-Id: Ib306f8f647014b399b87ffff13f0a3c155053e6a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Add QTemporaryDir::errorString()Thiago Macieira2015-07-171-13/+25
| | | | | | | | | | | [ChangeLog][QtCore][QTemporaryDir] Added errorString() method that returns the string explaining why creating the temporary directory failed. Change-Id: Ib306f8f647014b399b87ffff13f0a1f3c89e0a2c Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* QTemporaryDir: Remove directories on failureEskil Abrahamsen Blomfeldt2015-01-221-1/+4
| | | | | | | | | | | | | | When creating a temporary directory but failing to set its permissions, we need to remove the directory we created to avoid leaving 256 empty, unused directories in the destination folder. This happens on Android if you try creating a QTemporaryDir in the download path on the sdcard. Task-number: QTBUG-43352 Change-Id: Ic88fb7572f1abd65e5c7d8882b59c95f4b22ed72 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: corrected autolink errors corelib/ioNico Vertriest2014-11-261-1/+1
| | | | | | | Task-number: QTBUG-40362 Change-Id: I1cdbde1f6b003556ba4b5e97a49c6d918518da0d Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Doc: change the name of the QTemporaryDir parameter nameThiago Macieira2014-05-111-7/+7
| | | | | | | | | Make it very clear that this is a path, so it's relative to the working dir, not relative to tempPath(). Task-number: QTBUG-38266 Change-Id: Ib7ca8df76b5a03c1631fe00d6b329d86538d4b5a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Make QTemporaryDir file name more randomKai Koehne2013-12-121-14/+25
| | | | | | | | | | | | | qrand() returns a number between 0 and RAND_MAX, which is only guaranteed to be bigger than 32767. Dividing it repeatedly means that the last bytes are always 0. [ChangeLog][QtCore][QTemporaryDir] Fixed bug in QTemporaryDir name generator that dramatically reduced randomness of the name. Change-Id: I90613a652e6384296aed827e2714fe63cd8797ee Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-3/+3
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* QTemporaryDir: Output warnings on removal failure.Friedemann Kleint2013-10-031-1/+7
| | | | | Change-Id: I38d0a07c355f73899cc5f6eac60bd8cbedc73cb2 Reviewed-by: David Faure <david.faure@kdab.com>
* Introducing the Qt Android portPaul Olav Tvete2013-03-051-7/+7
| | | | | | | | | | | | | | | | | | | | | Based on the Necessitas project by Bogdan Vatra. Contributors to the Qt5 project: BogDan Vatra <bogdan@kde.org> Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> hjk <hjk121@nokiamail.com> Oswald Buddenhagen <oswald.buddenhagen@digia.com> Paul Olav Tvete <paul.tvete@digia.com> Robin Burchell <robin+qt@viroteck.net> Samuel Rødal <samuel.rodal@digia.com> Yoann Lopes <yoann.lopes@digia.com> The full history of the Qt5 port can be found in refs/old-heads/android, SHA-1 249ca9ca2c7d876b91b31df9434dde47f9065d0d Change-Id: Iff1a7b2dbb707c986f2639e65e39ed8f22430120 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* android: we have mkdtemp.Arvid Picciani2012-09-101-2/+4
| | | | | | | | | | they just forgot to declare it. see: bionic ad1ff2fb268034074488f0b4b30b5311008b8617 Change-Id: Ide0c0edaa1b5fd17e58ffce1e3d49e320d80e57a Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Arvid Picciani <aep@exys.org>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+1
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Fix qdoc erros in qfile and related classesLars Knoll2012-08-181-0/+2
| | | | | Change-Id: I56b66e6eeb06c84e1157a701a814aebb1ddf4845 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* mkdtemp() is not included in Android's libcRobin Burchell2012-05-021-2/+2
| | | | | | | | Use our own implementation instead. Change-Id: Ic04dd480d52404e03e26cdf4caa1d00e4c3219c7 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: David Faure <faure@kde.org>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-1/+1
| | | | | | | | | | | | This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Fix warnings about truncations in constants.Friedemann Kleint2012-04-031-2/+2
| | | | | Change-Id: I46872c5b2866454112092c1ec5efbfe15db5af33 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fixes QTemporaryDir compilation error under QNX.Rafael Roquetto2012-02-151-1/+1
| | | | | | | | Checking for Q_OS_QNX as well upon QFileSystemEngine inclusion. Change-Id: Ia0e0d7344abaae6dd6375528f0cc17dbefafe8d8 Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Use the QNX implementation of mkdtemp for win and wince.Andreas Holzammer2012-02-071-23/+14
| | | | | | | | | | There is no mktemp for Windows CE, nor mkdtemp. So use the implementation for QNX for Windows CE too, to simplify the implementation use it for windows too. Change-Id: Icddaf474a2d696752d8f9774fb4f033454e34e83 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Windows: Fix inclusion of <windows.h>Friedemann Kleint2012-02-011-1/+1
| | | | | | | | | | | | | - Always use <qt_windows.h> as the last file to be included. - Remove it from some headers, use Qt::HANDLE instead of HANDLE. - Clean up #ifdef, use Q_OS_WIN for Windows/Windows CE. - Add NOMINMAX to qt_windows.h to avoid problems with the min/max macros. - Remove <windows.h> from qplatformdefs.h (VS2005) Change-Id: Ic44e2cb3eafce38e1ad645c3bf85745439398e50 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* mkdtemp() support for QNX platformRafael Roquetto2012-01-311-0/+36
| | | | | | Change-Id: I30feebbbcdbe065e899a048da20ac887d4d48a4f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Add missing documentation to QTemporaryDir constructorsDavid Faure2012-01-241-0/+20
| | | | | | Change-Id: Ic7dea331695fa4653e4b963fef8383f44c3b1fb8 Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* QTemporaryDir/File: cleanups (static internal function, QScopedPointer)David Faure2011-12-081-6/+4
| | | | | Change-Id: I61311d151e2ae94a22df58297bbfb7a636a01c4a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unused includeDavid Faure2011-12-071-1/+0
| | | | | Change-Id: Idec12079fdc7ad29e780b537577050f01d8d076c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* New class QTemporaryDir.David Faure2011-12-021-0/+258
As discussed on qt5-feedback / development lists. Change-Id: If1733369d12daa29054776ec2cbd78e63679768e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>