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

QDir::currentPath() returns different drive for ROM applications between 4.7.4 and 4.8

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 4.8.0
    • Fix Version/s: 4.8.0
    • Component/s: Core: I/O
    • Environment:
      Symbian R&D SDK week 36 & week 41.
    • Commits:
      001c01e91d9c6cc724a374fcb8371a0551b21958

      Description

      Main qml is usually set somewhat like this:

      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QDeclarativeView view;
          view.setSource(QUrl::fromLocalFile("main.qml"));
          view.show();
      
          return app.exec();
      }
      

      QDeclarativeView::setSource() will end up calling

      QUrl::fromLocalFile(QDir::currentPath() + QDir::separator()).resolved(QUrl::fromLocalFile("main.qml"))
      

      Debug prints for Qt Quick application that is in ROM:

      Qt 4.7.4
      [Qt Message] QDir::currentPath(): "Z:/Private/200346e0"
      [Qt Message] QDir::homePath(): "C:/Data"
      [Qt Message] QDir::rootPath(): "C:/Data"
      [Qt Message] QCoreApplication::applicationDirPath(): "C:/Private/200346e0"
      [Qt Message] QCoreApplication::applicationFilePath(): "Z:\sys\bin\componenttest.exe"

      Qt 4.8
      [Qt Message] QDir::currentPath(): "C:/Private/200346e0"
      [Qt Message] QDir::homePath(): "C:/Data"
      [Qt Message] QDir::rootPath(): "C:/"
      [Qt Message] QCoreApplication::applicationDirPath(): "C:/Private/200346e0"
      [Qt Message] QCoreApplication::applicationFilePath(): "Z:\sys\bin\componenttest.exe"

      On 4.8 QDir::currentPath() returns C: drive instead of Z:. Main.qml is in z:/Private/200346e0 and end up getting error "file:///C:/Private/200346e0/main.qml: File not found".
      Just wondering can that is it ok to change QDir::currentPath() behavior like this between minor versions?

      This can be resolved on application level by giving absolute path to QDeclarativeView::setSource() instead.

        Attachments

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

          Activity

            People

            Assignee:
            shkearns Shane Kearns
            Reporter:
            samuelnevala Samuel Nevala
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes