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

QFileInfo ::isbundle() returns incorrect value

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 4.6.3, 4.8.4
    • Fix Version/s: 4.8.7, 5.3.0
    • Labels:
      None
    • Environment:
      mac OSX 10.6.8 mac OSX 10.5
    • Commits:
      Qt 5: afacf694d5a6f34b88989e76971d70d700ce4949 bcfc68f9cd00982decd7ceb312966caf6b1ca05e 72d60ea08c14037250459a5424ffee7a36b909b1 Qt 4: 4c45b6ca8ae38f56efab881f3c996a8a89edbd08

      Description

      The function QFileInfo::isbundle() return false for some bundles and true for others.

      I tested Qt4.6 32bits, Qt4.8 32bits and 4.8 64bits. All have the bug.

      Test protocole with my application :

      • An application declares a bundle document in its info.plist (IsBundle.app declares .qtbu as document)
      • I move the application to let the system takes care of the info.plist
      • This application creates a bundle with QDir().mkdir()
        o The Finder understands it is a bundle, thanks to the info.plist
        o The function QFileInfo ::isbundle() returns false. It should return true.
      • I create a directory with the finder called Test.qtbu
        o The Finder understands it is a bundle, thanks to the info.plist
        o The function QFileInfo ::isbundle() returns false. It should return true.

      Test protocole with iDVD :

      • iDVD is an application delivered by default by my mac.
      • I create TestA.dvdproj with iDVD
        o QFileInfo ::isbundle() returns true
      • I create TestB.dvdproj with the Finder
        o QFileInfo() ::isbundle() returns false. It should return true.

      A bundle is just a directory with an extension, so in all cases the function QFileInfo::isBundle() should in all these cases return true.

      I have browsed the Qt sources and found possible causes.

      I found in the Qt's code that a function of mac is used : CFBundleGetPackageInfoInDirectory.
      This function is normaly used to find the creator and the type of the bundle and return false if not found. I think this function can't assure that the directory is a bundle, juste if it is a bundle with a creator and type.
      Hence, it should not be used by QFileInfo() ::isbundle() . It is not the proper function to use there, I think.

      I also found in the .dvdproj a little file named Pkginfo. This file contains the creator and the type. But the Mac OS documentation explains this file is not necessary but can improve performance for code that accesses this information :
      https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/ConfigApplications.html

      • To confirme that, if I remove this file from TestA.dvdproj, it is still recognize as bundle in the Mac OS Finder AND by the test application.
      • If I add this file in a bundle, the function QFileInfo ::isbundle() return true but it is not a solution, this file is not in all bundles.

        Attachments

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

          Activity

            People

            Assignee:
            sgaist Samuel Gaist
            Reporter:
            deac Delphine Passinge
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes