Results 1 to 3 of 3

Thread: Windows file permission : isReadable()

  1. #1
    Join Date
    Oct 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Windows file permission : isReadable()

    Hello!

    I'm unsing QT Jambi to test read permissions on files and directory from a Java application :

    Qt Code:
    1. if (fileToRead.isDirectory()) {
    2. QDir qDir = new QDir(fileToRead.getAbsolutePath());
    3. System.out.println("Directory " + qDir.isReadable() + "--> " + fileToRead.getAbsolutePath());
    4. } else {
    5. QFileInfo qFileInfo = new QFileInfo(fileToRead.getAbsolutePath());
    6. System.out.println("File --> " + qFileInfo.isReadable() + "--> " + fileToRead.getAbsolutePath());
    7. }
    To copy to clipboard, switch view to plain text mode 

    The isReadable() method return allways true, even if the file or the directory is read protected ...

    Can anybody help me ...?

    Thanks!

    Fred
    Last edited by wysota; 4th October 2006 at 11:02. Reason: missing [code] tags

  2. #2
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Windows file permission : isReadable()

    I don't know anything about Qt Jambi, but on Windows, the read-only file attribute usually still allows you to read the file; you just can't write to it. Perhaps you want isWriteable()?
    Software Engineer



  3. #3
    Join Date
    Oct 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Windows file permission : isReadable()

    Hello!

    My idea is not to test the general read-only file attribute.

    I'm parsing all the files on a file system and I want to know if a file is read-protected for the current user or not...

    Any idea ?

Similar Threads

  1. Draging a non-existing file to the Windows Desktop
    By klaus1111 in forum Qt Programming
    Replies: 13
    Last Post: 20th September 2007, 11:47
  2. converting unix exe to windows binary
    By deekayt in forum General Programming
    Replies: 2
    Last Post: 17th September 2006, 01:00
  3. File permission QFile::WriteOther on Win Dos
    By patrik08 in forum Newbie
    Replies: 1
    Last Post: 13th June 2006, 14:16
  4. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52
  5. QProcess problem with windows batch file
    By bood in forum Qt Programming
    Replies: 11
    Last Post: 6th January 2006, 08:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.