Skip to content

Commit 0c95753

Browse files
author
Ioannis Giagkiozis
committed
plotly_kaleido path fix on windows
1 parent d39b74f commit 0c95753

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:cb2b305ce58ae27cd3d58a635c8f0c68687926089ee6069bad1fcc00284158d5
3-
size 99788800
2+
oid sha256:a47320508fa6c0d9263f8b209b1f2bc0f005978a127598a75eeb1d6827e56d1a
3+
size 99804672
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.1rc4
1+
0.0.1rc8

plotly_kaleido/src/lib.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub struct Kaleido {
7777
impl Kaleido {
7878
pub fn new() -> Kaleido {
7979
let path = match Kaleido::binary_path() {
80-
Ok(path) => std::fs::canonicalize(path).unwrap(),
80+
Ok(path) => path,
8181
Err(msg) => panic!(msg),
8282
};
8383

@@ -107,7 +107,7 @@ impl Kaleido {
107107
}
108108

109109
#[cfg(target_os = "macos")]
110-
fn kaleido_binary_path() -> Result<PathBuf, &'static str> {
110+
fn binary_path() -> Result<PathBuf, &'static str> {
111111
let mut p = Kaleido::root_dir()?;
112112
p = p
113113
.join("kaleido")
@@ -122,14 +122,9 @@ impl Kaleido {
122122
}
123123

124124
#[cfg(target_os = "windows")]
125-
fn kaleido_binary_path() -> Result<PathBuf, &'static str> {
125+
fn binary_path() -> Result<PathBuf, &'static str> {
126126
let mut p = Kaleido::root_dir()?;
127-
p = p
128-
.join("kaleido")
129-
.join("windows")
130-
.join("kaleido.cmd")
131-
.canonicalize()
132-
.unwrap();
127+
p = p.join("kaleido").join("windows").join("kaleido.cmd");
133128
if !p.exists() {
134129
return Err("could not find kaleido executable in path");
135130
}
@@ -157,7 +152,7 @@ impl Kaleido {
157152
.args(&["plotly", "--disable-gpu"])
158153
.stdin(Stdio::piped())
159154
.stdout(Stdio::piped())
160-
.stderr(Stdio::null())
155+
.stderr(Stdio::piped())
161156
.spawn()
162157
.expect("failed to spawn Kaleido binary");
163158

@@ -177,7 +172,7 @@ impl Kaleido {
177172
let res = KaleidoResult::from(l.as_str());
178173
if let Some(image_data) = res.result {
179174
let data: Vec<u8> = match image_format {
180-
"svg" => image_data.as_bytes().to_vec(),
175+
"svg" | "eps" => image_data.as_bytes().to_vec(),
181176
_ => base64::decode(image_data).unwrap(),
182177
};
183178
let mut file = File::create(dst.as_path())?;
@@ -187,6 +182,9 @@ impl Kaleido {
187182
}
188183
}
189184

185+
let mut errors = String::new();
186+
process.stderr.unwrap().read_to_string(&mut errors);
187+
println!("errors {}", errors);
190188
Ok(())
191189
}
192190
}

0 commit comments

Comments
 (0)