iOS
On iOS and iPadOS (sys.platform == "ios", as reported by CPython's official iOS builds), PlatformDirs is platformdirs.ios.IOS. Every iOS app runs in a sandbox, and its home directory (~) is the app's data container, so every path platformdirs returns stays inside that container. This page lists the directories and explains the choices behind them.
Examples use appname="SuperApp". appauthor, roaming, multipath, opinion and use_site_for_root have no effect, and XDG_* environment variables are ignored on iOS.
Directories
| Property | Path |
|---|---|
user_data_dir |
~/Library/Application Support/SuperApp |
user_config_dir |
same as user_data_dir |
user_state_dir |
same as user_data_dir |
user_preference_dir |
same as user_config_dir |
user_cache_dir |
~/Library/Caches/SuperApp |
user_log_dir |
~/Library/Logs/SuperApp |
user_runtime_dir |
~/tmp/SuperApp |
user_documents_dir |
~/Documents |
user_downloads_dir |
~/Documents/Downloads |
user_pictures_dir |
~/Documents/Pictures |
user_videos_dir |
~/Documents/Movies |
user_music_dir |
~/Documents/Music |
user_desktop_dir |
~/Documents/Desktop |
user_projects_dir |
~/Documents/Projects |
user_publicshare_dir |
~/Documents/Public |
user_templates_dir |
~/Documents/Templates |
user_fonts_dir |
~/Library/Fonts |
user_bin_dir |
~/.local/bin |
user_applications_dir |
~/Applications |
Every site_* property returns its user_* counterpart (site_data_dir is user_data_dir, site_bin_dir is user_bin_dir, and so on), because an app has no system-wide directories.
Why These Locations
- Application Support holds data, config, state and preferences together.
- Preferences are not in
Library/Preferences. Apple reserves that folder forNSUserDefaultsand tells apps not to create files there, souser_preference_dirreturns the config directory instead (unlike macOS). - Caches go to
~/Library/Caches, which iOS excludes from backups and may purge. - Runtime files go to
~/tmp, which the system may empty while the app is not running. - Media folders: the container has
Documentsbut no other media folder, so Downloads, Pictures and the rest are subfolders of~/Documents(the same placement Qt uses). If your app enables file sharing, users can see these in the Files app.
Home Directory Resolution
~ is expanded from HOME (or the password database when HOME is unset, empty or relative), like on other POSIX systems. If no absolute home can be found, properties raise RuntimeError: could not determine the home directory for '~/...'.
Creating Directories
With ensure_exists=True, app directories are created with mode 0700. Media, fonts, bin and applications directories are never created.