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

QCoreApplication::applicationFilePath() unnecessarily unreliable on unix

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes