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

Fix target directory when target argument is a path #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

parasyte
Copy link

I maintain cargo-n64 which uses a target JSON file (opposed to a target triple). When building a project with cargo-asm using a path as the target, it is unable to find the target directory:

[ERROR][cargo_asm::target][/Users/parasyte/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-asm-0.1.16/src/target.rs:103]: The target directory for the build does not exist: /var/folders/f0/yjjsr3hj2418r3lpmkk9gnt40000gn/T/n64-build/mips-nintendo64-none.json/release/deps
thread 'main' panicked at 'failed to iterate over the directory: /var/folders/f0/yjjsr3hj2418r3lpmkk9gnt40000gn/T/n64-build/mips-nintendo64-none.json/release/deps: Error { depth: 0, inner: Io { path: Some("/var/folders/f0/yjjsr3hj2418r3lpmkk9gnt40000gn/T/n64-build/mips-nintendo64-none.json/release/deps"), err: Os { code: 20, kind: Other, message: "Not a directory" } } }', /Users/parasyte/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-asm-0.1.16/src/build.rs:122:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This PR fixes the bug by detecting whether the target argument is a path (and points to a file that exists), then parses it down to the expected triple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant