How to access assets folder from Qt on ios?



  • 'm writing cross-platform mobile application using Qt/QML. The app installs along with a small sqlite database that at start copied from assets to application data location and than should be accessed by the app. For this purpose I have DatabaseManager class. It contains function that provide path to assets on different platforms:

    @QString DatabaseManager::assetsPath()
    {
    QString assetsPath;
    #ifdef Q_OS_WIN
    assetsPath = QDir::toNativeSeparators("assets:/../database");
    #endif

    #ifdef Q_OS_ANDROID
    assetsPath = QDir::toNativeSeparators("assets:/database");
    #endif

    #ifdef Q_OS_IOS
    assetsPath = QDir::toNativeSeparators("assets:/database");
    #endif

    #ifdef Q_OS_MAC
    assetsPath = QDir::toNativeSeparators("assets:/database");
    #endif

    return assetsPath;
    

    }@

    Assets deployed in .pro file with following code:

    @folder_qml.source = qml/HookahMixes
    folder_qml.target = qml

    folder_db.source = database
    folder_db.target = .

    DEPLOYMENTFOLDERS = folder_qml folder_db@

    The problem is that "assets:/" prefix works well on Windows and Android but doesn't work for ios and Mac OS. So the question is: what path to assets should I use to find database on that platforms?

    Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.