Results 1 to 2 of 2

Thread: QDir::mkPath and Permissions

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Posts
    44
    Thanks
    9
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QDir::mkPath and Permissions

    Hi,

    I am working on Ubuntu 12.04 LTS and 10.04 LTS platforms and I am having a problem with QDir::mkPath.
    I am trying to create a path using mkPath, lets say /john/play/games and then copy a file game.htm to the /home/john/play. After I copy the file I set the permissions on the file to rwxr - - r - -. So that 3rd party applications can read the file game.htm. But the directories /john, /john/play and /john/play/games are created with permissions drwxr - x - - - due to which other applications and other users are not able to read the file game.htm.

    I have also observed in a different application that the same QDir::mkpath creates the dir with drwxr - xr - x . I want to understand with what permissions does QDir::mkpath creates the directories and how to control or set the permissions.


    Sky.

  2. #2
    Join Date
    Dec 2010
    Posts
    44
    Thanks
    9
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDir::mkPath and Permissions

    You could, however, use the umask() OS function to set the umask to something else before calling QDir::mkpath. You might have to #ifdef it out on windows though, though I suspect the umask() function may have been implemented in the mingw environment being used by qtcreator on wnidows. So it may work anyway.

    Answer by Wes Hardaker on stackoverflow.

Similar Threads

  1. Finding user permissions
    By doggrant in forum Qt Programming
    Replies: 6
    Last Post: 22nd October 2009, 19:05
  2. QDir mkpath
    By yazwas in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2009, 21:21
  3. QDir::mkpath
    By drescherjm in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2009, 04:35
  4. mkpath error on Qt4.1.4
    By manhds in forum Qt Programming
    Replies: 2
    Last Post: 3rd August 2006, 12:34

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.