Unsolved How to check if a folder is writable using Qt?
-
I have tried the code, it is not working. it always satisfy the below conditional for all path whether it has write permission or not. what is the the other way to check whether the folder had write permission or not?
QFileInfo my_dir(folderName);
if(my_dir.isDir() && my_dir.isWritable()){
// Do something
} -
@Samananda
All sorts of questions, since you don't say what OS/filing system, whether NTFS etc etc. https://doc.qt.io/qt-5/qfileinfo.html#permission may help you. Then if you are Windows there is also http://doc.qt.io/qt-4.8/qfile.html#platform-specific-issues to bear in mind.It is even possible that you won't really know whether a directory is "writeable" till you try to create (e.g. a temporary) file/folder there and see what happens. NTFS, if that's what you're on, has a shed-load of possible sub-permissions, Windows has "restricted" folders...
-
This post is deleted! -
@JonB Thanks for the information.