summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemengine_win.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QDir: Add support for setting directory permissions to mkdir()Ievgenii Meshcheriakov2021-11-261-27/+279
| | | | | | | | | | | | | | This patch adds an overload of the QDir::mkdir() method that accepts permissions. This allows setting of the directory permissions at the time of its creation. [ChangeLog][QtCore][QDir] Added QDir::mdkir() overload that accepts permissions argument. Task-number: QTBUG-79750 Change-Id: Ic9db723b94ff0d2da6e0b819ac2e5d1f9a4e2049 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use Authz API to query permissions info in Windows filesystem backendIevgenii Meshcheriakov2021-11-191-117/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | Microsoft documentation for GetEffectiveRightsFromAclW function that was used previously has this at the top of the page: > GetEffectiveRightsFromAcl is available for use in the operating > systems specified in the Requirements section. It may be altered > or unavailable in subsequent versions. Instead, use the method > demonstrated in the example below. This says to me that the function is deprecated. In addition to that, it is not able to handle ACLs that are not in "canonical" order, returning ERROR_INVALID_ACL. Such ACLs are useful to represent POSIX permissions in Windows, and are produced by Cygwin for example. This patch uses Authz API referenced by the message quoted above. The used API is available starting from Windows XP/Windows Server 2003. This API also allowe to perform access checks given access token, and so allows to use similar code all permission checks. Task-number: QTBUG-79750 Change-Id: I8b11ff3cc83cd9ed5bfb2ce9432a375a122cdbbf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFileSystemEngine: Fix permissions query in Windows backendIevgenii Meshcheriakov2021-11-181-1/+1
| | | | | | | | | Make fillPermissions() correctly set OtherExecutePermission instead of OwnerExecutePermission. Pick-to: 6.2 Change-Id: I77ef3c5bc59ac6110c5a461a599d03029c70493c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFileSystemEngine: Don't use _?W suffixesIevgenii Meshcheriakov2021-11-101-7/+7
| | | | | | | | | We don't use W suffix for most of the Windows API so there is no need to use it here either. Also remove W suffix for variables of type TRUSTEE (was TRUSTEE_W). Change-Id: Id67b772ba5d3232f882841a1e581fb1bbd392fa4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use nullptr to represent null pointersIevgenii Meshcheriakov2021-11-101-39/+36
| | | | | | | Replace occurrences of NULL and 0 when used for pointers. Change-Id: I485e73d22a1a85d1303f3e0967cd4e8f10ff5d33 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFileSystemEngine: Fix some code style issues in Windows backendIevgenii Meshcheriakov2021-11-101-55/+113
| | | | | | | | | | | Wrap lines at column 101 so that it is easier to edit the file and review the changes in Gerrit. Move comments when they cannot be easily wrapped. Add curly braces to `if` statements if they became multiline. Run `git clang-format` on the file afterwards. Change-Id: Ib21afd65147a7b202e031d4a865b5f615e5ad6d8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove useless blocksIevgenii Meshcheriakov2021-11-101-38/+34
| | | | | | | Don't put the code inside two blocks for no reason. Change-Id: I54b8d6fbfab50a26ddcd8ec07ba689e5094bcad3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)Yuhang Zhao2021-11-101-9/+0
| | | | | | | | | | | And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time, to unblock the developers from accessing the latest Windows APIs. Pick-to: 6.2 Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QDir::mkpath() return true when given an existing drive nameKarsten Heimrich2021-10-201-1/+1
| | | | | | | | | | | | Commit ed48391c592e8ba68c723e3017ac384f0c7a7c23 removed the check for ERROR_ACCESS_DENIED reported by the Windows CreateDirectory(...) function in case an existing windows drive name was passed as argument. This restores the behavior of the function which broke after 5.15. Pick-to: 6.2 Fixes: QTBUG-85997 Change-Id: Ie86188100766f7364acee57b15a250f4a2720b9f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Replace 0 with nullptrKarsten Heimrich2021-10-021-2/+2
| | | | | | Change-Id: I9ee25644a3e066391e881bd2f64274909eabfcbf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix QDir::entryList to work for directories that end with '.lnk'Karsten Heimrich2021-09-301-4/+3
| | | | | | | | | | | | | In addition to checking the .lnk extension, check that the the specified path is not a path to a directory. Pick-to: 6.2 Fixes: QTBUG-85058 Change-Id: I83cef3d94c6ffa82a88f374c5b41779e88fe40b8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix compile with MinGW-W64 9.0.0: Redefinition of 'struct _FILE_ID_INFO'Jonas Kvinge2021-08-181-2/+2
| | | | | | | | | | | With MinGW-W64 9.0.0, _WIN32_WINNT is set to Windows 10 by default, so _FILE_ID_INFO is already defined. Fixes: QTBUG-94031 Pick-to: 6.2 Change-Id: I0b29a4a1932425e1c4079aba6768fe94460c60af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* io: Remove version checks for versions below Win 10Mårten Nordheim2021-07-281-71/+35
| | | | | | | It's not supported. Change-Id: Ia17fc7e1d5ae785eca0a6ba530f9b9bc960605d4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement QFileInfo::junctionTarget(), adjust auto-testKarsten Heimrich2021-06-051-0/+20
| | | | | | | | | | | | The change in 004e3e0dc2cab4a4534d2ed3ace41aad6bfbe45d introduces Windows junction awareness, though users were still unable to resolve the junction target. This change adds the ability to solve this. Fixes: QTBUG-93869 Change-Id: I9f4d4ed87b92e757f7b6d8739e2a61b58c096f63 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Unify behavior for long path or UNC prefix removalKarsten Heimrich2021-06-051-12/+2
| | | | | | | | | | | | | Split the code out of QDir::fromNativeSeparator into a separate reusable function to remove the above-mentioned prefixes. Fixes and unifies behavior if the prefix was given with slashes instead of backslashes. Add a couple more test cases. Fixes: QTBUG-93868 Pick-to: 5.15 6.0 6.1 Change-Id: Ibd94ae283e2fb113f9c2db97475fbc7d89522bbf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Implement QFileSystemEngine::createLink() on MS-WinKarsten Heimrich2021-05-121-5/+33
| | | | | | | | | Fixes: QTBUG-74271 Change-Id: I9e414dd16546f65e85b5a1a6c70c40dfa4284a6f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Use Core library for qmake instead of the Bootstrap libraryAlexey Edelev2021-02-251-2/+2
| | | | | | | | | | | | | | | | | | | Move the qmake-specific logic of the QLibraryInfo class to qmake internals. 'qconfig.cpp.in' now stores information about the library info entries to keep them consistent between qmake and the Core library. qmake requires specific features enabled in the Core library, so building qmake will be skipped if the features are not enabled. All flags directly related to the qmake have been removed from Core lib. Remove all bootstrap related sections from qmake CMakeLists.txt Task-number: QTBUG-89369 Change-Id: I26de157d3bfd4a5526699296e9d46e1c180b89ae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-15/+15
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix build with mingw gcc 9 and -Wsuggest-overrideKai Koehne2020-08-101-30/+21
| | | | | Change-Id: I780b0761a7f6b19022116b738efa7aca1378b715 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QFileInfo: Fail faster when stat'ing filepath on a disconnected driveVolker Hilsheimer2020-07-291-6/+8
| | | | | | | | | | | | | The Windows implementation of QFileSystemEngine tries hard to fill the metadata for a file, even if GetFileAttributesEx returns with error. This is good in many situations, but when the error code indicates that the drive on which the file resides has been disconnected, then we should fail quickly. Task-number: QTBUG-6039 Pick-to: 5.15 Change-Id: I7574c5a2e524e913306d0b470b4f227416442c13 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-3/+3
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use QList instead of QVector in corelib implementationJarek Kobus2020-06-291-3/+2
| | | | | | | | Omitting state machine and docs for now. Task-number: QTBUG-84469 Change-Id: Ibfa5e7035515773461f6cdbff35299315ef65737 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Port QDir, QFile from QStringRef to QStringViewLars Knoll2020-06-121-3/+3
| | | | | | Task-number: QTBUG-84319 Change-Id: I7feb5c12eb5a8504c34292e0da75332b5ba9ef20 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove winrtOliver Wolff2020-06-061-176/+9
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QFile::moveToTrash: work with relative file paths on WindowsVolker Hilsheimer2020-05-071-2/+2
| | | | | | | | | | | | | | | | | | | | The system APIs expect an absolute "display name" of the file path, so make it absolute. The test was overly tolerant in accepting failure, as a QStorageInfo initialized with a file path that doesn't exist is invalid, and thus always different from the QStorageInfo of the home directory. Fix the test to compare only valid QStorageInfo objects, and postpone the check until the file we want to move has been created. [ChangeLog][QtCore][QFile] moveToTrash supports relative file paths on Windows Change-Id: I94c8cd40c60fde469e38f76a98f867f20c6a0b15 Fixes: QTBUG-84015 Pick-to: 5.15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Port qfilesystemengine_win.cpp to QRegularExpressionLars Knoll2020-04-151-5/+10
| | | | | | | QRegExp is going away in Qt 6. Change-Id: I282a444b9fdf1c834dcf90d7fd6743781b94643c Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Core: Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-02-281-1/+1
| | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: I446f9ddc8f8de4a0b79b09edb44f7c1496fbc33f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* On Windows 7, fall back to SHFileOperation to avoid confirmation dialogsVolker Hilsheimer2020-02-071-63/+69
| | | | | | | | | | | | | | | | | | | | Moving a file to the trash should preferably done via IFileOperation. However, the implementation on Windows 7 ignores the operation flags that request the shell not to show any confirmation dialogs or other UI elements. SHFileOperation is an old API that doesn't show any UI, but has the limitation that it doesn't report the location of the file in the trash after the move. So an application cannot restore the file, but the user can do so via Explorer. Overall, the better compromise is to not have dialogs at the expense of not being able to report the new path. This allows us to run the unit test on Windows 7 as well. Change-Id: Ib8e651a69e2c6750f668b52d2a70925d156cc8ae Fixes: QTBUG-81927 Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
* Implement moving of a single file system entry to the trashVolker Hilsheimer2020-01-301-0/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the operation for Windows, macOS, and Unix, for now only as a private API (since QFileSystemEngine is private). This adds the capability as a testable function; public API to be agreed on and added in a separate commit. The Unix implementation follows the freedesktop.org specification [1] version 1.0. [1] https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html On macOS and Windows, native APIs are used, with each having some limitations: * on macOS, the file in the trash won't have a "put back" option, as we don't use Finder automation, for the reasons provided in the comments * on Windows, we might not be able to use the modern IFileOperation API, e.g. if Qt is built with mingw which doesn't seem to provide the interface definition; the fallback doesn't provide access to the file name in the trash The test case creates files and directories, and moves them to the trash. As part of the cleanup routine, it deletes all file system entries created. If run on Windows without IFileOperations support, this will add a file in the trash for each test run, filling up hard drive space. Task-number: QTBUG-47703 Change-Id: I5f5f4e578be2f45d7da84f70a03acbe1a12a1231 Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
* QFileSystemEngine: Rework createDirectory on WindowsChristoph Schleifenbaum2019-10-251-54/+49
| | | | | | | | | | Try starting to create the directory at the end, not at the front. This is the same way as the Unix implementation is doing. This avoids problems like us trying to enter directories we are not allowed to read, which might be due to access rights or due to sandboxing. Change-Id: I67c1ed4bdc20a15b1af9b33aa48d59fea359da22 Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
* QFileSystemEngine: Consistently check for invalid file namesUlf Hermann2019-10-241-1/+26
| | | | | | | | | | | | | | stat() and friends expect a null-terminated C string. There is no way to generate anything useful from a string that has null bytes in the middle. It's important to catch this early, as otherwise, for example, a QDir::exists() on such a path can return true, as the path is silently truncated. Extend the checks for empty file names to windows and add checks for null bytes. Change-Id: Ie9794c3a7c4fd57f9a66bdbbab8b45a08b6f9170 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix resolving NTFS symbolic links that point to UNC sharesVolker Hilsheimer2019-04-101-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | Without this change, the target of a symbolic link that points to a UNC share would include UNC in the target path, and not be correctly made absolute. Add a relevant test case, and use the opportunity to factor out the helper code that creates NTFS symlinks into a function that takes care of error handling. The file created with the new test case only gets cleaned up correctly when passing the file path into QDir::rmdir, which is either way the right thing to do. [ChangeLog][QtCore][QFileInfo] Fixed resolving of symbolic links to UNC shares on NTFS file systems. Change-Id: I9ba75d627aedf7c4cc289f0cb71088d795d30d8a Fixes: QTBUG-73688 Task-number: QTBUG-63970 Task-number: QTBUG-30401 Task-number: QTBUG-20791 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows: Fix QFileSystemEngine::id() for FAT32 drivesFriedemann Kleint2019-04-021-1/+3
| | | | | | | | | | GetFileInformationByHandleEx() which is used to to obtain the ID, has been found to fail on FAT32 (USB removable drives). Fall back to GetFileInformationByHandle() for these. Fixes: QTBUG-74759 Change-Id: Ib3ef60a6bf9e9edaf41af86bf71666001cb0aa58 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qfilesystemengine_win: Update LinkType whenever askedMårten Nordheim2019-01-221-2/+1
| | | | | | | | | | | | | | | | Checking the known flags prevented us from correctly setting the LinkType flag if we had previously set LinkType as a known flag since the flag is not reset between updates. Manifested itself in situations where the file info is loaded and then the LegacyLinkType flag is checked through QFileInfoPrivate::checkAttribute. Since the LegacyLinkType is not set for Windows it will update the metadata and exclude the LinkType flag. Change-Id: Iea27f42fe11f36ba2247e52fa9c82b4639666a64 Fixes: QTBUG-72644 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qfilesystemengine: add missed Q_CHECK_PTRIvan Komissarov2018-10-201-0/+3
| | | | | | | | | There might be dereferencing of a potential null pointer Task-number: QTBUG-71156 Change-Id: I202d314d001917a2de0500caf762d2b54ff517cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
* Windows code: Fix clang-tidy warnings about C-style castsFriedemann Kleint2018-08-301-6/+10
| | | | | | | | | | | Replace by reinterpret_cast or const_cast, respectively. Use auto when initializing a variable to fix Clang warnings about repeating the type name, do minor tidying along the way, and a few conversions of 0 or NULL to nullptr. Change-Id: Ieb271a87ddcf064f536e1ff05d23b1e688b1b56a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-041-0/+0
|\ | | | | | | Change-Id: I3fa5c9e216201bdf7da260c395f65d7fb95cba0b
| * Fix source code file permissionsSimon Hausmann2018-01-021-0/+0
| | | | | | | | | | | | | | | | Fix permissions after commit ffc8409aa58c04c1dd140001976b55925ac959f6 - our source files are not executable. Change-Id: Idc5103704256b6f73857b645c323492beaabe879 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Lars Knoll2017-12-301-9/+55
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/win32-g++/qmake.conf src/corelib/global/qglobal_p.h src/corelib/global/qoperatingsystemversion_p.h src/corelib/io/qfilesystemengine_win.cpp src/network/bearer/qbearerengine.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/sql/doc/snippets/code/doc_src_sql-driver.cpp src/widgets/kernel/qwidget_p.h src/widgets/kernel/qwidgetwindow.cpp src/widgets/styles/qfusionstyle.cpp tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp Change-Id: I80e2722f481b12fff5d967c28f89208c0e9a1dd8
| * Use AccessCheck for current user effective file permissionsDyami Caliri2017-12-211-9/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | On Windows, QFileInfo.isWritable() was returning true in situations where the file would only be writable with elevated privileges. Using AccessCheck instead of GetEffectiveRightsFromAcl to get the correct results. Done-with: Friedemann Kleint <Friedemann.Kleint@qt.io> Done-with: Edward Welbourne <edward.welbourne@qt.io> Task-number: QTBUG-30148 Change-Id: I7a3468ac069bf782ca312078e3a84107b6cd468c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-231-0/+3
|\| | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/direct2d/direct2d.pro src/plugins/platforms/ios/qiosclipboard.mm src/plugins/platforms/windows/windows.pro Change-Id: Idffa03b3990bd642784f528821c5446b2e1008ef
| * winrt: Fully initialize CREATEFILE2_EXTENDED_PARAMETERS structOliver Wolff2017-10-201-0/+3
| | | | | | | | | | | | | | | | | | Not properly initializing all members of the extended parameter struct will cause an "invalid handle specified" exception on use. Task-number: QTBUG-63883 Change-Id: Ic3a58df864c9e29ccbadc04bd71c18c8ef34374c Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-09-061-4/+9
|\| | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/qopenglwidget/main.cpp src/3rdparty/pcre2/src/pcre2_printint.c src/plugins/platforms/cocoa/qnsview.mm src/widgets/widgets/qcombobox.cpp Change-Id: I37ced9da1e8056f95851568bcc52cd5dc34f56af
| * Fix resolution of relative links on WindowsOrgad Shaneh2017-09-041-4/+9
| | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QFileInfo] Relative symbolic links on Windows are now resolved to their absolute path by symLinkTarget(). Task-number: QTBUG-62802 Change-Id: I5826517130bd389aef994bf3f4b6d99b2a91b409 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | QFileSystemEngine/Windows: fix setFileTime when input date is UTCThiago Macieira2017-08-051-15/+30
| | | | | | | | | | | | | | | | | | | | | | I was getting a weird 7-hour offset when doing: QVERIFY(file.setFileTime(before.addSecs(-10), QFile::FileModificationTime)); mtime = file.fileTime(QFile::FileModificationTime).toUTC(); QCOMPARE(mtime, before.addSecs(-10)); Change-Id: I35c4da69d754686a43e675b3d215213e448df7cf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Filesystem: Use "birth time" to avoid confusion with Unix ctimeThiago Macieira2017-08-051-6/+16
| | | | | | | | | | | | | | | | | | | | | | The Unix stat fields "st_ctime" and "st_ctim" mean "change time", the last time that the file/inode status fields were changed. It does not mean "creation time". So this commit splits all of the internal API to "birth" and "metadata change" instead of "creation" to avoid the conflict. Change-Id: I149e0540c00745fe8119fffd1463fe78b619649e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Move platform-specific code from QFSFileEngine to QFileSystemEngineThiago Macieira2017-08-051-0/+58
| | | | | | | | | | Change-Id: I8d96dea9955d4c749b99fffd14cd9395174ba005 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QFSFileEngine: make rename() on Unix not overwriteThiago Macieira2017-08-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rename(2) system call overwrites, so instead of using it, we try to use the link/unlink pair. This works for regular cases, but can fail if trying to change case in case-insensitive filesystems, if we're operating on a non-Unix filesystem (FAT) or, on Linux, if the file doesn't belong to the calling user (BSDs permit this). For those cases, we fall back to rename(2). That means there's a race condition if a new file is created there. But we at least reduce the likelihood of that happening for regular files. Change-Id: I1eba2b016de74620bfc8fffd14ccb38fd929e5aa Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.9' into devOswald Buddenhagen2017-08-021-3/+10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/widgets/qdockarealayout.cpp src/widgets/widgets/qmainwindow.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmainwindowlayout_p.h tests/auto/corelib/tools/qlocale/tst_qlocale.cpp tests/auto/other/macnativeevents/BLACKLIST tests/auto/widgets/widgets/qmenu/BLACKLIST Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567