Skip to content

Commit e596ded

Browse files
committed
fix: adjust rust cli venv cache path
use venv/ dir and use base64 url encoder to avoid / in hash dir name Signed-off-by: Nick Mitchell <[email protected]>
1 parent c9c6982 commit e596ded

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pdl-live-react/src-tauri/src/interpreter/pip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub async fn pip_install_if_needed(
1515
create_dir_all(&cache_path)?;
1616

1717
let hash = shasum::sha256sum(&requirements_path)?;
18-
let venv_path = cache_path.join(hash);
18+
let venv_path = cache_path.join("venvs").join(hash);
1919
let bin_path = venv_path.join(if cfg!(windows) { "Scripts" } else { "bin" });
2020

2121
if !venv_path.exists() {

pdl-live-react/src-tauri/src/interpreter/shasum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use ::std::fs::File;
22
use ::std::io::{copy, Result};
33
use ::std::path::Path;
44

5-
use base64ct::{Base64, Encoding};
5+
use base64ct::{Base64Url, Encoding};
66
use sha2::{Digest, Sha256};
77

88
pub fn sha256sum(path: &Path) -> Result<String> {
@@ -12,5 +12,5 @@ pub fn sha256sum(path: &Path) -> Result<String> {
1212
copy(&mut file, &mut hasher)?;
1313
let hash_bytes = hasher.finalize();
1414

15-
Ok(Base64::encode_string(&hash_bytes))
15+
Ok(Base64Url::encode_string(&hash_bytes))
1616
}

0 commit comments

Comments
 (0)