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] [v2] Cannot create a file when that file already exists when bundling workspace binaries #9666

Closed
pronebird opened this issue May 6, 2024 · 0 comments · Fixed by #9710
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@pronebird
Copy link
Contributor

pronebird commented May 6, 2024

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

@pronebird pronebird added status: needs triage This issue needs to triage, applied to new issues type: bug labels May 6, 2024
amrbashir added a commit that referenced this issue May 8, 2024
lucasfernog added a commit that referenced this issue May 28, 2024
* fix(build): avoid copying resource onto itself

closes #9666

* canonicalize once

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
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

Successfully merging a pull request may close this issue.

1 participant