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. Get executable path on linux
Forum Updated to NodeBB v4.3 + New Features

Get executable path on linux

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 544 Views 1 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.
  • H Offline
    H Offline
    hbatalha
    wrote on last edited by hbatalha
    #1

    My app uses a custom build of ffmpeg that I keep the in the app install location so it doesn't conflicts with the official ffmpeg in case user has it in his machine.

    I want to get its install location and for that I use, like in Windows, QString QDir::currentPath() but the problem I am facing is that I am installing the program through a deb package and so by my tests QDir::currentPath() will point to the location of the deb file since it is the parent of my app executable because deb installation creates a symbolic link of the my app executable to /usr/bin/ .

    Right now I install my app in /opt/my_app_name/ and I could set current path there but, even though unlikely. the user might change that location and I need to know where my executable is so I can determine the ffmpeg location and avoid errors.

    I hope I made myself clear.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      QDir::currentPath() is not the location of the application, it is the running application's current working directory. This, even on Windows, can be anywhere.

      QCoreApplication::applicationDirPath() is your best bet.

      H 1 Reply Last reply
      5
      • C ChrisW67

        QDir::currentPath() is not the location of the application, it is the running application's current working directory. This, even on Windows, can be anywhere.

        QCoreApplication::applicationDirPath() is your best bet.

        H Offline
        H Offline
        hbatalha
        wrote on last edited by
        #3

        @ChrisW67 Thanks

        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