Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-21381

QCoreApplication::applicationFilePath() unnecessarily unreliable on unix

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P2: Important
    • None
    • 4.7.4, 5.10
    • Core: I/O
    • None
    • Unix

    Description

      one of the fallback paths in this function reads QDir::current().absoluteFilePath(argv0). the problem here is that QDir::current() does not necessarily represent the cwd at the time the application was started.

      this is a problem for QLibraryInfo, which uses that function to locate qt.conf.

      i'm not entirely sure what to do about it. one could preemptively save the pwd (or even the executable location) in the qapp c'tor. but that comes at a small additional cost, and isn't even reliable (as the qapp is not guaranteed to be created first. maybe a static object would work "in most of the cases"?).

      note that this usually does not affect linux, as it has a specialized code path based on /proc.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              buddenha Oswald Buddenhagen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes