pd-rs / crank

A wrapper for cargo to use creating games for the Playdate handheld gaming system.
MIT License
85 stars 15 forks source link

Fix "file not found" error when the crate name contains hyphens #48

Closed parasyte closed 1 year ago

parasyte commented 1 year ago

The library is written with hyphens replaced with underscores.


Example that demonstrates the bug:

Cargo.toml:

[package]
name = "hello-world"

Crank.toml:

[[target]]
name = "hello-world"

[target.metadata]
name = "Hello World"
version = "0.1.0"
$ RUST_LOG=debug crank build --release --example hello-world

# ... snip ...

 DEBUG crank > copy: "C:\\Users\\jay\\other-projects\\crankstart\\target\\release\\examples/hello-world.dll" -> "C:\\Users\\jay\\other-projects\\crankstart\\target\\Hello World\\pdex.dll"
Error: The system cannot find the file specified. (os error 2)
$ ls -la target/release/examples/*.dll

-rwxr-xr-x 2 jay 197121 139264 Aug 26 17:58 target/release/examples/hello_world.dll*
-rwxr-xr-x 2 jay 197121 139264 Aug 26 17:58 target/release/examples/hello_world-30373b030c92bf1c.dll*

After applying the patch:

$ RUST_LOG=debug crank build --release --example hello-world

# ... snip ...

 DEBUG crank > copy: "C:\\Users\\jay\\other-projects\\crankstart\\target\\release\\examples/hello_world.dll" -> "C:\\Users\\jay\\other-projects\\crankstart\\target\\Hello World\\pdex.dll"
 INFO  crank > copy_assets

# ... etc, and it completes successfully!
parasyte commented 1 year ago

The failing tests are caused by having two versions of the zip crate (0.5 and 0.6), which is unrelated to this PR.

I'll see what it takes to fix that, though. It will be fixed in its own PR and I'll rebase this (and the other open PR) after the fix is merged.