tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
85.38k stars 2.58k forks source link

[bug] fail to run examples/file-associations #11703

Closed JunaYa closed 3 days ago

JunaYa commented 6 days ago

Describe the bug

Run the following inside examples/file-associations/src-tauri

error[E0599]: no method named asset_protocol_scope found for struct AppHandle in the current scope --> examples/file-associations/src-tauri/src/main.rs:23:34 | 23 | let asset_protocol_scope = app.asset_protocol_scope(); | ^^^^^^^^^^^^^^^^^^^^ method not found in AppHandle

For more information about this error, try rustc --explain E0599. warning: tauri-file-associations-demo (bin "tauri-file-associations-demo") generated 1 warning error: could not compile tauri-file-associations-demo (bin "tauri-file-associations-demo") due to 1 previous error; 1 warning emitted

Reproduction

https://github.com/tauri-apps/tauri/tree/dev/examples/file-associations

Run the following inside examples/file-associations/src-tauri

cd tauri/examples/file-associations/src-tauri

cargo build

Expected behavior

Build suceeds

Full tauri info output

my other project

pnpm tauri info

> ddu@0.1.0 tauri /Users/aya/Code/tauri/ddu
> tauri "info"

[✔] Environment
    - OS: Mac OS 12.7.6 x86_64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-apple-darwin (default)
    - node: 20.11.0
    - pnpm: 9.0.1
    - yarn: 1.22.21
    - npm: 10.2.4
    - deno: deno 1.44.0

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.0
    - tao 🦀: 0.30.8
    - @tauri-apps/api : 2.1.1
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-autostart 🦀: 2.0.1
    - @tauri-apps/plugin-autostart : 2.0.0
    - tauri-plugin-dialog 🦀: 2.0.3
    - @tauri-apps/plugin-dialog : 2.0.1
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-fs 🦀: 2.0.3
    - @tauri-apps/plugin-fs : 2.0.2

[-] App
    - build-type: bundle
    - CSP: connect-src ipc: http://ipc.localhost; font-src https://fonts.gstatic.com; img-src 'self' asset: http://asset.localhost blob: data:; style-src 'unsafe-inline' 'self' https://fonts.googleapis.com; default-src 'self' customprotocol: asset:
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

FabianLars commented 5 days ago

The example's readme is wrong, i think cargo build --features tauri/protocol-asset should work