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

QFileInfo::fileName() does not strip assets prefix on Android

    XMLWordPrintable

Details

    • Android
    • 76619eae4 (dev), 3e7d4f165 (6.5.2), d48a15a59 (6.5), 6a2956172 (6.6)

    Description

      QFileInfo::fileName() returns filename with assets:/ prefix 

      Folder with structure as https://github.com/MerginMaps/input/tree/master/app/android/assets/qgis-data

      with code snipped

       

       // srcPath = "assets:/qgis-data"
        QDir srcDir( srcPath );
        const QFileInfoList fileInfoList = srcDir.entryInfoList( QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden );
        foreach ( const QFileInfo &info, fileInfoList )
        {
            QString fileName = info.fileName();
            qDebug() << "src: " << srcPath + "/" + fileName;
        } 

       

      produces invalid paths for QFile::copy (double assets:/)

       

      ...
      D Input   : "2023-06-05T08:40:53.572Z src: assets:/qgis-data/assets:/proj_custom
      D Input   : "2023-06-05T08:40:53.573Z src: assets:/qgis-data/assets:/resources
      ...
      

       

      When workaround as such is applied, it QFile::copy works as before 

       

          if (fileName.startsWith("assets:/")) {
            fileName.remove(0, 8);
          }

       

       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-114219
          # Subject Branch Project Status CR V

          Activity

            People

              taipan BogDan Vatra
              zilolv Peter Petrik
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes