Can't remove file
-
Hi,
My application extracts a file from it's own resource, but can't remove the created file (because it's read only).
eg:QFile::copy(":/resources/res/line.dwg", "D:/MediaCad/MediaCadQt/win32/debug/temp/line.dwg"); QFile::remove("D:/MediaCad/MediaCadQt/win32/debug/temp/line.dwg");// does not workHow can I fix this ?
Thanks -
Hi,
My application extracts a file from it's own resource, but can't remove the created file (because it's read only).
eg:QFile::copy(":/resources/res/line.dwg", "D:/MediaCad/MediaCadQt/win32/debug/temp/line.dwg"); QFile::remove("D:/MediaCad/MediaCadQt/win32/debug/temp/line.dwg");// does not workHow can I fix this ?
Thanks -
These actions are not adjacents.
Event after application quit, the file is still read only.(Sorry for my english)
@Roy44
If it's really true that the file is read-only after copying, under Windows:file.setPermissions(QFile::ReadOther | QFile::WriteOther); file.remove();Also you should be checking the returns results of your
copy()andremove(), and usingQFileDevice::FileError QFileDevice::error() constto discover the reason why.