c++qtqfile

QFile is not allowed to change permissions for the file


I create QFile and set up permissions like this:

/*Reading information to file*/
file.setPermissions(QFile::ReadOwner | QFile::ReadOther | QFile::ReadGroup | QFile::WriteOwner | QFile::WriteOther | QFile::WriteGroup)
file.close()

Than I make this file as a resources file and connect it to my project. But something like this:

QFile file{ R"(:/text/TextInformation/Matters)" };
qDebug() << file.permissions() << '\n';

give me such output:

QFlags(0x4|0x40|0x400|0x4000)

Another problem: if I try to change permissions now, I getting failed. In propeties to my resource file I allow to read it and to write on it. How can I change the permissions now (or how can open this file in QFile::WriteOnly mode)?


Solution

  • Modifying resources compiled into the executable is not possible - if you want to modify such a file you have to write it out the the filesystem and modify it there.