Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating Path /data/print
Forum Updated to NodeBB v4.3 + New Features

Creating Path /data/print

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 406 Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • fcarneyF Offline
    fcarneyF Offline
    fcarney
    wrote on last edited by
    #1

    I have a directory named "/data". I have permissions to this directory (755). The owner is my user name for both group and user. Then I try to do the following:

            QDir path("/data/print");
            if(!path.exists()){
                if(!path.mkdir(".")){
                   // always calling this code as it fails
                   // checked and new directory is not there
                }
            }
    

    I am running Ubuntu 18.04. Qt 5.12.5. 64 bit. mingw.

    C++ is a perfectly valid school of magic.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Why are you using "." for your createDir call ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      fcarneyF 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Why are you using "." for your createDir call ?

        fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #3

        @SGaist I tried with and without the '.' The function requires a string. I want it to create the path using the path stored in the QDir object.

        C++ is a perfectly valid school of magic.

        1 Reply Last reply
        0
        • fcarneyF Offline
          fcarneyF Offline
          fcarney
          wrote on last edited by
          #4

          Okay, this works:

          path.mkdir(path.path())
          

          Annoying and redundant, but it works.

          C++ is a perfectly valid school of magic.

          Pl45m4P 1 Reply Last reply
          1
          • fcarneyF fcarney

            Okay, this works:

            path.mkdir(path.path())
            

            Annoying and redundant, but it works.

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by Pl45m4
            #5

            @fcarney

            A directory name starting with . will hide the folder. So maybe the directory was there, but you couldn't see it.

            I dont know if QDir or QFile can access hidden dirs or files, so I guess that's the reason why the check failed all the time (if nothing else went wrong)


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply
            0
            • Kent-DorfmanK Offline
              Kent-DorfmanK Offline
              Kent-Dorfman
              wrote on last edited by
              #6

              @Pl45m4 said in Creating Path /data/print:

              I dont know if QDir or QFile can access hidden dirs or files

              Yes, they can.

              I light my way forward with the fires of all the bridges I've burned behind me.

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved