beeware/toga

Add path shortcuts for common user-space paths

Open

#3,551 建立於 2025年6月13日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)Python (3,615 star) (624 fork)batch import
enhancementgood first issue

描述

What is the problem or limitation you are having?

Toga has a paths module that provides an anchor point for paths in the app, and for common "sandbox" locations such as config, data, and logs.

However, there's no anchor for common "user space" locations, such as "Documents", "Pictures" or "Desktop". These are all locations that an app may want to use; and are cross platform (on desktop, anyway).

Describe the solution you'd like

paths.desktop, paths.pictures, and paths.desktop should all return appropriate user-specific file system anchors.

Describe alternatives you've considered

We could pass responsibility for this off to platformdirs, as it provides analogous functionality.

Additional context

  • On Linux, the FreeDesktop specification defines "known locations". The implementation provided by platformdirs could be used to inform what directories should be used, even if we don't actually use platformdirs in the implementation.
  • On macOS, permissions are often required to access Desktop, Documents etc; we should check if those permissions are requested automatically on first access, or if an explicit permission check is required.
  • On iOS (and Android?), there's probably not a folder that can be used for these paths. If there's no viable path, a platform should raise an exception.

貢獻者指南