Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [solved] Mavericks File Permission Problem

[solved] Mavericks File Permission Problem

Scheduled Pinned Locked Moved Installation and Deployment
15 Posts 3 Posters 3.9k Views
  • 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.
  • B Offline
    B Offline
    brebarth
    wrote on last edited by
    #6

    yes I have.... but not in sudo mode..

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

      And that's correct, you don't need to run it in sudo mode.

      Can you create a minimal example program that shows the problem ?

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

      1 Reply Last reply
      0
      • B Offline
        B Offline
        brebarth
        wrote on last edited by
        #8

        I made a minimal code version of the problem I have.

        Compiled with Qt 5.2rc and qtmacdeployed on Mavericks. Source included.

        When launched it will attempt to open one file ("Controls.xml"). If success it will open a QMessageBox "Success"
        otherwise a QMessageBox with "Fail"

        On Mavericks:
        -running this as sudo or from QtCreator -> success
        -running it from finder -> fails.

        To test it, get it here ( couldn't figure out how to attach this zip here..):

        https://drive.google.com/file/d/0B2hpkmDPq1oaRUEyYmdYWEUyV2s/edit?usp=sharing

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

          Just tested it (Had to rebuild your sources, OS X told me It could not open the app because it was from an unidentified developer)
          The problems come from the fact that you try to open Controls.xml without giving the path to the file so it's relative to the "current path" of the application. In Mavericks, Apple has modified what working directory it gives to the application and e.g. calling it from the console (./My.app/Contents/MacOS/My) or from finder, will not give the same result, thus your file is really not found

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

          1 Reply Last reply
          0
          • B Offline
            B Offline
            brebarth
            wrote on last edited by
            #10

            So you mean, instead of "Controls.xml"

            I should attempt to open "../../Controls.xml"

            ?

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

              For the sake of testing, you should give the absolute path e.g. "/Users/your_user_name/path_to/Controls.xml"

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

              1 Reply Last reply
              0
              • B Offline
                B Offline
                brebarth
                wrote on last edited by
                #12

                Just tested it and it works fine with “/Users/your_user_name/path_to/Controls.xml”
                both from QtCreator and from Finder. So that's great for testing..

                But I can't use that for deployment. And the ../../../ thing doesn't seem to work..
                when I use
                "../../../Controls.xml"
                as path (relative to the executable) it works, when running from QtCreator but it doesn't work via double click starting from finder.

                What could be the solution?

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  brebarth
                  wrote on last edited by
                  #13

                  i.e. is there a way to tell Qt in the .pro file to set the working dir? Or what would I do?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sandy.martel
                    wrote on last edited by
                    #14

                    The working dir is set by the parent process. You'll get different result if you launch from the Finder or the terminal. This is not a reliable way to find your resources.
                    Look at QCoreApplication::applicationDirPath or QStandardPaths::locate.

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      brebarth
                      wrote on last edited by
                      #15

                      Thanks. A combination of using
                      QCoreApplication::applicationDirPath and QDir worked to solve this.

                      1 Reply Last reply
                      0

                      • Login

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