tauri-apps / tauri

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

[bug] [v2] Cannot create a file when that file already exists when bundling workspace binaries #9666

Open pronebird opened 1 week ago

pronebird commented 1 week ago

Describe the bug

Hi,

I build workspace binaries on Windows, those binaries are compiled into target/release. I am attempting to include those binaries with my application by specifying a resource map as such:

"resources": {
  "../../target/release/my-other-bin.exe": "my-other-bin.exe"
}

However the bundler errors with:

cargo:rerun-if-changed=..\..\target\release\my-other-bin.exe
  Cannot create a file when that file already exists. (os error 183)

It looks like it attempts to copy file where source and destination are the same.

Perhaps we could filter out attempts to copy files when files are already in-place, when source and destination paths match.

Note that this is not a problem on macOS (universal build), because workspace binaries there are built into target/universal-apple-darwin/release and so the copying works fine.

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 124.0.2478.80
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.79.0-nightly (becebb315 2024-04-17)
    ✔ cargo: 1.79.0-nightly (6f06fe908 2024-04-16)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: nightly-x86_64-pc-windows-msvc (default)
    - node: 22.1.0
    - npm: 10.7.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.17 (no manifest)
    - tauri-build [RUST]: 2.0.0-beta.13 (no manifest)
    - wry [RUST]: 0.39.3 (no manifest)
    - tao [RUST]: 0.27.1 (no manifest)
    - @tauri-apps/api [NPM]: 2.0.0-beta.11
    - @tauri-apps/cli [NPM]: 2.0.0-beta.15

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

Stack trace

No response

Additional context

No response