Skip to content

Commit

Permalink
rust: fix windows absolute path resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
randommm committed Feb 18, 2024
1 parent c9d1d95 commit 6fb0bf1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ ureq = { version = "2.7", optional = true }
tar = { version = "0.4", optional = true }
flate2 = { version = "1.0", optional = true }
dirs = { version = "5.0", optional = true }
path-absolutize = { version = "3.1", optional = true }

[features]
compile-stan-model = ["ureq", "tar", "flate2", "dirs"]
compile-stan-model = ["ureq", "tar", "flate2", "dirs", "path-absolutize"]

[build-dependencies]
bindgen = "0.69.1"
Expand Down
5 changes: 4 additions & 1 deletion rust/src/download_compile.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::bs_safe::{BridgeStanError, Result};
use flate2::read::GzDecoder;
use path_absolutize::Absolutize;
use std::{
env::temp_dir,
fs,
Expand Down Expand Up @@ -81,7 +82,9 @@ where
None => get_bridgestan_src()?,
};

let stan_file = fs::canonicalize(stan_file)
let stan_file = stan_file
.as_ref()
.absolutize()
.map_err(|e| BridgeStanError::ModelCompilingFailed(e.to_string()))?;

if stan_file.extension().unwrap_or_default() != "stan" {
Expand Down

0 comments on commit 6fb0bf1

Please sign in to comment.