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

Webassembly add persistent AppLocalDataLocation

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.7.0 Beta1
    • Core: Other
    • None
    • WebAssembly

    Description

      All operating systems provide a series of standard locations that applications can use to save data, which is necessary to preserve the state of the application when it is closed. They also offer standard locations for other uses, like temporary storage.

      Applications can retrieve these standard locations using the QStandardPaths class. Almost all applications assume that a standard AppLocalDataLocation, among other locations, exists and use it to save persistent and temporary data.

      The AppLocalDataLocation and other locations are crucial because they store data persistently, ensuring that information (such as application state, user preferences, log files, and application extensions) is immediately available after the application is closed and reopened. This location is also necessary for saving data that the user has modified (for example, the content of an editor) in case the application is closed before there's time to save to a proper local file or cloud location.

      Unfortunately, in WebAssembly, the standard locations for data retrieval do not exist. It is possible to use Emscripten to mount a filesystem that utilizes the browser's persistent storage. Then, it is necessary to create the appropriate locations using QDir. Once developers have done this, they can easily use QDir and QFile to create and access directories and files.

      However, unlike a normal filesystem, the data in WebAssembly is not automatically synchronized with the browser's database. Developers must also ensure that the data on the filesystem is properly synchronized with the browser storage. This may be quite challenging.

      To easily port QT applications to WebAssembly, it would be beneficial if WebAssembly applications could automatically rely on a persistent standard location, just as desktop applications do.

      Therefore, there should be a mechanism that, when a QT WebAssembly application starts, the QT framework automatically creates a persistent storage location and makes it available, along with other useful storage locations (for example, for temporary files), behaving the same as a normal desktop application. When the application is closed, the data should be automatically stored in the browser's persistent storage. The data in the AppLocalDataLocation should then be automatically available when the application restarts.

      The QSettings class has been already modified to automatically provide a local storage on WebAssembly. So the approach for provide AppLocalDataLocation should be the same.

      Regarding the other standard directories. The File System Access API already define how to have access to the WellKnownDirectory on the local file system.

      I assume the information provided sufficiently explains the request, without delving too much into technical details. Should the feature be developed, an analysis regarding which standard locations ought to be made available will be necessary.

      If you need more info let me know.

      I first mentioned this need in the issue https://bugreports.qt.io/browse/QTBUG-102409

      Attachments

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

        Activity

          People

            qt.webassembly qt.webassembly
            domezuk Domenico Zucchetti
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes