PDA

View Full Version : File permission QFile::WriteOther on Win Dos



patrik08
12th June 2006, 22:01
If I copy a resource file to a tmp cache dir... so...
MoveAndCopy(QString::fromUtf8(":/images/images/master.sql"),STATIC_TMP_SQL_DUMP);

after this file is readonly to user....
How i set write and remove from application? and edit from user?





bool Gui_Front::MoveAndCopy(QString file, QString destfile)
{
QFile Image(file);
if (db->is_file(destfile)) {
db->qt_unlink(destfile);
}
if (!Image.copy(destfile)) {
/*QMessageBox::warning( this,tr( "File Error!" ) , tr("Unable to copy a file to.. %1").arg( destfile ));*/
return false;
} else {
QFile Image2(destfile);
Image2.setPermissions(QFile::WriteOther); /* all 0777 */
return true;
}
}

Bojan
13th June 2006, 14:16
I dont have Qt here so I can't try it, but I think you need to set all the permissions something like this:


Image2.setPermissions(QFile::ReadOwner | QFile::WriteOwner |
QFile::ReadUser | QFile::WriteUser | QFile::ReadGroup |
QFile::WriteGroup | QFile::ReadOther | QFile::WriteOther); /* all 0777 */

Bojan