Porting the mode_t uses
David Faure
faure at kde.org
Fri Jul 19 19:50:54 UTC 2013
On Friday 19 July 2013 19:56:46 Aleix Pol wrote:
> Hi,
> We've been looking into the tasks to be done in the kdelibs cleanup and
> I've been looking into the mode_t port. It's obviously not a trivial task,
> since we don't have any adequate replacement for all the required values
> [1].
>
> I guess the best move would be to extend QFile::Permissions to fit our
> needs, although I'm unsure if the Qt Project would be welcome such change.
>
> An alternative would be to create some class that abstracts permissions out
> in a KDE framework, but I doubt we want to move the dependencies (like
> karchive) another tier.
>
> Any suggestions?
Interesting. Since you mentionned KArchive, I had a look at the karchive_qt4
branch where Ivan Komissarov ported the code to Windows. I still need to merge
that in.
And it says this:
+#ifdef Q_OS_WIN
+#include <qplatformdefs.h> // mode_t
+#endif
which indeed defines mode_t on Windows:
It also defines QT_STAT_REG (to _S_IFREG)
and QT_STAT_DIR (to _S_IFDIR).
So S_ISDIR(mode) should be ported to (mode & QT_STAT_DIR), etc.
This suddenly sounds a hell of a lot easier than using QFile::Permissions.
Sorry for missing this earlier.
There might be a bit of reverting to do, like parts of
b03e81a61311ae1b64b0d37415477f9c08fe6142
which added QFile::Permissions stuff - for nothing, I see now.
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
More information about the Kde-frameworks-devel
mailing list