Audit for a possible convergence on using `platformdirs` for app paths
#4.666 geöffnet am 18.08.2026
Repository-Metriken
- Stars
- (3.615 Sterne)
- PR-Merge-Metriken
- (PR-Metriken ausstehend)
Beschreibung
What is the problem or limitation you are having?
#4645 introduced the use of platformdirs as the basis for accessing app and user paths on Linux-based apps (including Linux deployments of Textual-based apps). This allows us to lean on platformdirs as an implementation of XDG and other platform-specific mechanisms for finding app-related paths.
platformdirs also has support for macOS, Windows and Android. We should be making better use of the platformdirs implementation, rather than duplicating the implementation.
Describe the solution you'd like
We should use platformdirs as the basis for macOS (Cocoa) and Windows (Winforms) implementation of app paths.
The complication is that these backends already have existing implementations for platform paths, and there are known discrepancies between the paths returned by platformdirs, and the paths returned by the existing backend implementations.
On each backend, and each of the paths supported by platformdirs, we need to know:
- The path/path scheme that platformdirs returns
- The path/path scheme currently returned by the Toga backend
- Which is correct based on platform standards? If it's a matter of "taste" rather than a strict platform standard, that should be made clear in the analysis
- Is there a plausible migration scheme from Toga's current path usage to a platformdirs-based implementation?
The ultimate "completion" of this task is not any code - it is purely a design decision on how to proceed further - this will be either:
- Abandon the idea
- Progress forward, with a clear plan for migration or backwards incompatibilities that will be accepted.
Describe alternatives you've considered
Status quo - keep a duplication of platform dirs.
Additional context
Platformdirs also contains support for Android, but using pyjnius, so it isn't compatible with Toga. It doesn't have support for iOS.
Ideally, we'd get Toga-compatible support upstream in platformdirs, and use that as the basis for migrating the iOS and Android backends to use platformdirs.