Skip to content

Commit

Permalink
Merge pull request #83 from MartinKavik/fix/dependency_conflicts
Browse files Browse the repository at this point in the history
Fix Windows problems with packages and index.html.
  • Loading branch information
thedodd authored Oct 16, 2020
2 parents ad19190 + e95abe3 commit 8f9bdbe
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ changelog
This changelog follows the patterns described here: https://keepachangelog.com/en/1.0.0/.

## Unreleased
### fixed
- Closed [#82](https://github.com/thedodd/trunk/issues/82): Remove the hardcoded Unix (`/`) path separator from the code and convert Windows NT UNC path to its simplified alternative before passing to `cargo metadata` command to prevent issues with Rust package collisions and writing `index.html` file.

## 0.7.2
### fixed
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ async-process = "0.1.1"
async-std = { version="1.6.3", features=["attributes", "unstable"] }
cargo_metadata = "0.11.3"
console = "0.12.0"
dunce = "1.0.1"
envy = "0.4.1"
fs_extra = "1.2.0"
futures = "0.3.5"
Expand Down
2 changes: 1 addition & 1 deletion src/config/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl CargoMetadata {
// Create a new instance from the Cargo.toml at the given path.
pub async fn new(manifest: &Path) -> Result<Self> {
let mut cmd = MetadataCommand::new();
cmd.manifest_path(manifest);
cmd.manifest_path(dunce::simplified(manifest));
let metadata = spawn_blocking(move || cmd.exec()).await?;
let package = metadata
.root_package()
Expand Down
4 changes: 2 additions & 2 deletions src/pipelines/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ impl HtmlPipeline {

// Assemble a new output index.html file.
let output_html = target_html.html(); // TODO: prettify this output.
fs::write(format!("{}/index.html", self.cfg.dist.display()), output_html.as_bytes())
fs::write(self.cfg.dist.join("index.html"), output_html.as_bytes())
.await
.context("error writing finalized HTML output")?;
.context("error writing finalized HTML output")?; // TODO: show also error details (in a verbose mode?)
Ok(())
}

Expand Down

0 comments on commit 8f9bdbe

Please sign in to comment.