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. Start MaintenanceTool.app from my application under macOS
Forum Updated to NodeBB v4.3 + New Features

Start MaintenanceTool.app from my application under macOS

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 2.1k 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.
  • F Offline
    F Offline
    Francky033
    wrote on last edited by
    #1

    Under macOS, I would like to start MaintenanceTool.app from my application.

    MaintenanceTool is in the same directory as my application.

    I use startDetached in this way:

    QProcess::startDetached("~/" + QStandardPaths::displayName(QStandardPaths::ApplicationsLocation) + "/myappl/MaintenanceTool.app/Contents/MacOS/MaintenanceTool");
    

    The response is true but MaintenanceTool does not start.

    How to do this?

    J.HilkJ jsulmJ 2 Replies Last reply
    0
    • F Offline
      F Offline
      Francky033
      wrote on last edited by Francky033
      #4

      Thank you J.Hilk, it works perfectly!

      1 Reply Last reply
      2
      • F Francky033

        Under macOS, I would like to start MaintenanceTool.app from my application.

        MaintenanceTool is in the same directory as my application.

        I use startDetached in this way:

        QProcess::startDetached("~/" + QStandardPaths::displayName(QStandardPaths::ApplicationsLocation) + "/myappl/MaintenanceTool.app/Contents/MacOS/MaintenanceTool");
        

        The response is true but MaintenanceTool does not start.

        How to do this?

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by J.Hilk
        #2

        hi
        @Francky033 said in Start MaintenanceTool.app from my application under macOS:
        ("~/" + QStandardPaths::displayName(QStandardPaths::ApplicationsLocation)

        are you sure this returns the correct path?

        I usually get the path via QApplication::applicationDirPath(), modify the string and start the process that way,

        something along this line:

            QString path = QApplication::applicationDirPath();
            if(path.contains("myApp.app/Contents/MacOS"))
                path = path.remove("myApp.app/Contents/MacOS");
            path = path + "maintenancetool.app/Contents/MacOS/maintenancetool";
            process->start(path,args);
        

        But I'm by no means a Mac expert, and this was quite literally the first thing I tried, backing than, and I've been running with an - don't fix it if it's not broken - approach ever since ;-)


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        3
        • F Francky033

          Under macOS, I would like to start MaintenanceTool.app from my application.

          MaintenanceTool is in the same directory as my application.

          I use startDetached in this way:

          QProcess::startDetached("~/" + QStandardPaths::displayName(QStandardPaths::ApplicationsLocation) + "/myappl/MaintenanceTool.app/Contents/MacOS/MaintenanceTool");
          

          The response is true but MaintenanceTool does not start.

          How to do this?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #3

          @Francky033 said in Start MaintenanceTool.app from my application under macOS:

          QStandardPaths::displayName(QStandardPaths::ApplicationsLocation)

          Doesn't this return an absolute path?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Francky033
            wrote on last edited by Francky033
            #4

            Thank you J.Hilk, it works perfectly!

            1 Reply Last reply
            2

            • Login

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