Skip to content

Conversation

@onehumandev
Copy link

@onehumandev onehumandev commented Dec 2, 2025

feat: Add support for AppLibrary, AppTemp, and AppCache (#12276)

Previously, there was no access to 3 specific paths used by iOS.

We have added support for these directories, and added documentation
explaining how these different methods are meant to be used.

This also required the creation of a Swift plugin to allow us to access
these iOS APIs.

There was a thought that we would be able to add access to these directories
by setting a feature flag in the plugin and having conditional retrieval of
the needed directories.

However, this proved to be much more complex than needed, since in reality we are able to
make this a purely additive change, with the only changed output being for the appCacheDir method on iOS. In the related issue #12276 , it was stated this could be acceptable.

Comparisons of the returned values before and after these changes for both Android and iOS are
attached here.
Android comparison:
PostChangeResults-Android.csv

iOS comparison:
PostChangeResults-iOS.csv

In this process, we have added a page to the sample views to immediately
see the output of the different path methods.

This required some visual fixes of the examples/api app for the menu button
to be usable on modern Android devices to work with insets.)

…2276)

Previously, there was no access to 3 specific paths used by iOS.

We have added support for these directories, and added documentation
explaining how these different methods are meant to be used.

This also required the creation of a Swift plugin to allow us to access
these iOS APIs.

In this process, we have added a page to the sample views to immediately
see the output of the different path methods.

This required some visual fixes of the examples/api app for the menu button
to be usable on modern Android devices to work with insets.)feat: Add support for AppLibrary, AppTemp, and AppCache (tauri-apps#12276)

Previously, there was no access to 3 specific paths used by iOS.

We have added support for these directories, and added documentation
explaining how these different methods are meant to be used.

This also required the creation of a Swift plugin to allow us to access
these iOS APIs.

In this process, we have added a page to the sample views to immediately
see the output of the different path methods.

This required some visual fixes of the examples/api app for the menu button
to be usable on modern Android devices to work with insets.)
@github-project-automation github-project-automation bot moved this to 📬Proposal in Roadmap Dec 2, 2025
@onehumandev onehumandev changed the title feat: Add support for AppLibrary, AppTemp, and AppCache (#12276) feat: Add support for AppDocuments, AppLibrary and AppTemp (#12276) Dec 9, 2025

/// Returns the path to the app's documents directory.
pub fn app_documents_dir(&self) -> Result<PathBuf> {
self.call_resolve("getFilesDir")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these methods call getFilesDir and return the same path. What about external files directory on Android? Would this be a better fit for app_documents_dir? How is this pattern handled in other platforms like Expo, MAUI etc?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have mixed thoughts on where the entry point for getExternalFilesDir should exist.
I lean strongly toward it being a completely separate method because it simply doesn't exist on the other platforms, and I don't know how much we are expecting devs to fully read the docs to understand the mapping from API method to the actual implementation.
However, if this all should be handled in Tauri V3, perhaps this new method can point to getExternalFilesDir, and we can add comments at the Rust and TS layers describing the behavior on Android.
Does that make sense @velocitysystems ?

Cross-platform comparison (brought to you by Claude 😄 )

Expo (React / Expo FileSystem)

Exposes only app-scoped directories (documentDirectory, cacheDirectory).
On Android these map to internal app storage (effectively Context.getFilesDir() / getCacheDir()).
There is no API surface for getExternalFilesDir(); user-visible files are handled via sharing or pickers.
Rationale: maintain strict iOS parity and hide Android-specific storage topology.

.NET MAUI

Exposes AppDataDirectory and CacheDirectory, which on Android map to internal app storage (getFilesDir(), getCacheDir()).
MAUI does not expose external app storage in the cross-platform API.
Access to getExternalFilesDir() requires platform-specific Android code, intentionally outside the portable abstraction.

Capacitor (used with web stacks, often compared to Electron on mobile)

Exposes a Directory enum (Data, Cache, Documents, External, ExternalStorage, etc.).
On Android, the native plugin explicitly maps:

  • DatagetFilesDir() (internal storage)
  • CachegetCacheDir() (internal storage)
  • DocumentsgetExternalFilesDir(Environment.DIRECTORY_DOCUMENTS) (app-specific external storage)
  • ExternalgetExternalFilesDir(null) (app-specific external storage root)
  • ExternalStorage → primary shared/external storage (separate from getExternalFilesDir(); requires special permissions on Android 10+)

This is the only examined cross-platform stack that intentionally exposes Android external app storage as a first-class concept.

Electron (desktop)

Not applicable to Android; uses OS-level concepts (userData, documents, downloads).
There is no internal/external distinction analogous to Android; mobile behavior depends on wrappers (e.g., Capacitor).

Summary

Most cross-platform frameworks (Expo, MAUI) collapse Android internal vs external app storage into a single "app data" abstraction to preserve iOS parity. Capacitor is the notable exception, explicitly modeling getExternalFilesDir() in its cross-platform API, with the caveat that ExternalStorage access requires additional permissions on Android 10+ due to scoped storage restrictions.

@github-project-automation github-project-automation bot moved this from 📬Proposal to 🏗 In progress in Roadmap Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

2 participants