I am trying to check if a folder is writable so I can prompt an error dialog. I am trying this:
QFileDevice::Permissions permissions_list = QFile( folderName ).permissions();
if ( permissions_list && QFileDevice::WriteUser )
{
}
but it does not work. It's the same for both writable folders and restricted ones.
use QFileInfo:
QFileInfo my_dir(folderName);
if(my_dir.isDir() && my_dir.isWritable()){
// Do something
}
but pay attention to this problem if you're on Windows
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With