[Qt-interest] Invalid permissions for folder!

John McClurkin jwm at nei.nih.gov
Thu Aug 27 13:13:29 CEST 2009


Iurii Gordiienko wrote:
> 
> Hi
> I have a folder without "Read & Execute" permissions for me on WindowsXP.
> For checking that I use code similar this, but it does not work (b 
> always is TRUE)... What's wrong?
>   QFile::Permissions perm = QFileInfo( "c:/ACCESS_DENIED/" ).permissions();
> 
>   bool 
>   b = perm & QFile::ReadOwner;
>   b = perm & QFile::WriteOwner;
>   b = perm & QFile::ExeOwner;
> 
>   b = perm & QFile::ReadUser;
>   b = perm & QFile::WriteUser;
>   b = perm & QFile::ExeUser;
> 
>   b = perm & QFile::ReadGroup;
>   b = perm & QFile::WriteGroup;
>   b = perm & QFile::ExeGroup;
> 
>   b = perm & QFile::ReadOther;
>   b = perm & QFile::WriteOther;
>   b = perm & QFile::ExeOther;
> 
> 
> Qt-4.5.2
> Thanks
> 
> --
> With regards
> Iurii Gordiienko
> 
> <http://www.ukr.net/Y7o7lk/footer/38df05>
Check the value of perm (printf("perm = %d\n", perm)). If it is -1 all 
of your tests would evaluate to true and it might indicate a failure of 
the QFileInfo constructor.



More information about the Qt-interest-old mailing list