Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] App data directory does not resolve to correct path #12276

Open
velocitysystems opened this issue Jan 6, 2025 · 1 comment
Open

[bug] App data directory does not resolve to correct path #12276

velocitysystems opened this issue Jan 6, 2025 · 1 comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@velocitysystems
Copy link

velocitysystems commented Jan 6, 2025

Describe the bug

appDataDir does not resolve to correct path on each platform. The resolved path should exist without having to create it.

See example below for macOS, iOS and Android.

macOS:
/Users/johndoe/Library/Application Support/com.company.appname

iOS:
/Users/johndoe/Library/Developer/CoreSimulator/Devices/6C6435C0-2956-46E4-B7EE-006D5C14770A/data/Containers/Data/Application/5537853B-26D5-4B30-B99E-373146D19848/Library/Application Support/com.company.appname

Android:
/data/user/0/com.company.appname

Reproduction

Use the appDataDir API from @tauri-apps/api.

Expected behavior

macOS

  • Unsigned applications typically store application data under: ~/Library/Application Support/[App Name]
  • Signed (sandboxed) macOS applications have directories located under the ~/Library/Containers folder. E.g. ~/Library/Containers/[Bundle Identifier]/Data/[Subfolder]

iOS

  • Sandbox paths are managed by the system and vary for each app. Each app gets its unique directory under /var/mobile/Containers E.g. /var/mobile/Containers/Data/Application/[UUID]/[Subfolder]

Full tauri info output

[✔] Environment
    - OS: Mac OS 15.2.0 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.83.0 (90b35a623 2024-11-26)
    ✔ cargo: 1.83.0 (5ffbef321 2024-10-29)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 22.12.0
    - pnpm: 9.15.2
    - npm: 10.9.0

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.2
    - tao 🦀: 0.30.8
    - @tauri-apps/api : 2.1.1 (outdated, latest: 2.2.0)
    - @tauri-apps/cli : 2.1.0 (outdated, latest: 2.2.2)

[-] Plugins
    - tauri-plugin-http 🦀: 2.2.0
    - @tauri-apps/plugin-http : 2.2.0
    - tauri-plugin-sql 🦀: 2.2.0
    - @tauri-apps/plugin-sql : 2.2.0
    - tauri-plugin-os 🦀: 2.2.0
    - @tauri-apps/plugin-os : 2.0.0 (outdated, latest: 2.2.0)
    - tauri-plugin-fs 🦀: 2.2.0
    - @tauri-apps/plugin-fs : 2.2.0
    - tauri-plugin-upload 🦀: 2.2.1
    - @tauri-apps/plugin-upload : 2.2.1
    - tauri-plugin-log 🦀: 2.2.0
    - @tauri-apps/plugin-log : 2.0.1 (outdated, latest: 2.2.0)

[-] App
    - build-type: bundle
    - CSP: default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost
    - frontendDist: ../dist
    - devUrl: http://localhost:5173/
    - framework: Vue.js
    - bundler: Rollup

Stack trace

No response

Additional context

#5263

@velocitysystems velocitysystems added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jan 6, 2025
@FabianLars
Copy link
Member

The resolved path should exist without having to create it.

This is not how Tauri handled paths ever. It never creates paths it doesn't need itself.

Unsigned applications typically store application data under: ~/Library/Application Support/[App Name]

Our choice to use the id is indeed a bit weird, same on windows for example but it's not been a real issue either. (still wanna change it at some point ig)

Signed (sandboxed) macOS applications have directories located under the ~/Library/Containers folder. E.g. ~/Library/Containers/[Bundle Identifier]/Data/[Subfolder]

Our sandbox support is a bit lackluster but this may already work, at least i didn't hear about issues with it before. Did you test this as well?

iOS /Users/johndoe/Library/Developer/CoreSimulator/Devices/6C6435C0-2956-46E4-B7EE-006D5C14770A/data/Containers/Data/Application/5537853B-26D5-4B30-B99E-373146D19848/Library/Application Support/com.company.appname

Everything up to /Library/Application Support/com.company.appname comes from iOS directly. The rest comes from the dirs crate applying macOS logic on iOS (of course we could just do it ourselves). A bit ugly but still working afaik.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants