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.36k stars 2.58k forks source link

[bug] Windows notification silently fails if the executable is not in release folder #11757

Closed sh0ber closed 1 day ago

sh0ber commented 1 day ago

Describe the bug

After adding Tauri 2.0 notifications plugin to build for Windows, everything works great unless the exe is moved outside of the release folder. When running the exe from any other folder, or even just renaming the release folder, notifications silently fail though everything else continues to work properly.

Reproduction

  1. Create a fresh Tauri 2.0 app
  2. Install tauri-notification
  3. Leave all default configuration but add the code from the notification docs to send a notification
  4. npm run tauri build
  5. Everything works
  6. Move the executable outside the release folder or rename the release folder
  7. Notifications no longer work, silently fail. Everything else works.

Expected behavior

I expect that notifications will not silently fail after moving the .exe outside of the release folder. Everything else works as expected.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 130.0.2849.80
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.18.0
    - npm: 10.8.2

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

[-] Plugins
    - tauri-plugin-notification 🦀: 2.0.1
    - @tauri-apps/plugin-notification : 2.0.0
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:5173/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

FabianLars commented 1 day ago

This is more or less expected, see https://github.com/tauri-apps/plugins-workspace/pull/1502 for example. The notification plugin only really works if the app was actually installed.

In v1 it would show the powershell icon instead but in v2 it either fails silently or sometimes still shows the powershell icon (which is a bit weird so it may be a windows caching thingy again).

I also just updated the metadata so the support matrix at the top here https://v2.tauri.app/plugin/notification/ should display it soon.