Can't remove file
Solved
General and Desktop
-
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 work
How 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 work
How 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() const
to discover the reason why.