From 88e7a4f661da166e81171a3188f6290c40a2f748 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 20 Oct 2014 12:17:24 +0200 Subject: Doc: QFileDevice and QFile::setPermissions do not manipulate ACLs Task-number: QTBUG-41271 Change-Id: Id97add8a6fdb7ce59020e833f6dc11744c9aaa7e Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qfile.cpp | 12 +++++++++++- src/corelib/io/qfiledevice.cpp | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 6fe4c2455b..d3411abf10 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -206,6 +206,13 @@ QAbstractFileEngine *QFilePrivate::engine() const directory usually is not writable, but it is still possible to create files in it. + Qt's understanding of file permissions is limited, which affects especially + the \l QFile::setPermissions() function. On Windows, Qt will set only the + legacy read-only flag, and that only when none of the Write* flags are + passed. Qt does not manipulate access control lists (ACLs), which makes this + function mostly useless for NTFS volumes. It may still be of use for USB + sticks that use VFAT file systems. POSIX ACLs are not manipulated, either. + \sa QTextStream, QDataStream, QFileInfo, QDir, {The Qt Resource System} */ @@ -1063,9 +1070,12 @@ QFile::permissions(const QString &fileName) /*! Sets the permissions for the file to the \a permissions specified. - Returns \c true if successful, or false if the permissions cannot be + Returns \c true if successful, or \c false if the permissions cannot be modified. + \warning This function does not manipulate ACLs, which may limit its + effectiveness. + \sa permissions(), setFileName() */ diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp index 8d1c59e159..598347a56f 100644 --- a/src/corelib/io/qfiledevice.cpp +++ b/src/corelib/io/qfiledevice.cpp @@ -648,9 +648,12 @@ QFile::Permissions QFileDevice::permissions() const /*! Sets the permissions for the file to the \a permissions specified. - Returns \c true if successful, or false if the permissions cannot be + Returns \c true if successful, or \c false if the permissions cannot be modified. + \warning This function does not manipulate ACLs, which may limit its + effectiveness. + \sa permissions() */ bool QFileDevice::setPermissions(Permissions permissions) -- cgit v1.2.3