mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -05:00
trim after splitting
This commit is contained in:
parent
88752aeeb7
commit
fd1cbd38b0
1 changed files with 4 additions and 4 deletions
|
|
@ -1085,11 +1085,11 @@ fn get_python_env_info(state: &State) -> Result<(String, std::path::PathBuf, CSt
|
||||||
if let Ok(cached) = read_file(&state.libpython_info) {
|
if let Ok(cached) = read_file(&state.libpython_info) {
|
||||||
if let Ok(cached) = String::from_utf8(cached) {
|
if let Ok(cached) = String::from_utf8(cached) {
|
||||||
if let Some((version, lib_path)) = cached.split_once('\n') {
|
if let Some((version, lib_path)) = cached.split_once('\n') {
|
||||||
if let Ok(lib_path) = state.uv_install_root.join(lib_path).canonicalize() {
|
if let Ok(lib_path) = state.uv_install_root.join(lib_path.trim()).canonicalize() {
|
||||||
// make sure we're still within AnkiProgramFiles...
|
// make sure we're still within AnkiProgramFiles...
|
||||||
if lib_path.strip_prefix(&state.uv_install_root).is_ok() {
|
if lib_path.strip_prefix(&state.uv_install_root).is_ok() {
|
||||||
return Ok((
|
return Ok((
|
||||||
version.to_string(),
|
version.trim().to_string(),
|
||||||
lib_path,
|
lib_path,
|
||||||
CString::new(python_exe.as_os_str().as_encoded_bytes())?,
|
CString::new(python_exe.as_os_str().as_encoded_bytes())?,
|
||||||
));
|
));
|
||||||
|
|
@ -1124,7 +1124,7 @@ fn get_python_env_info(state: &State) -> Result<(String, std::path::PathBuf, CSt
|
||||||
let (version, lib_path) = output
|
let (version, lib_path) = output
|
||||||
.split_once('\n')
|
.split_once('\n')
|
||||||
.ok_or_else(|| anyhow!("invalid libpython info"))?;
|
.ok_or_else(|| anyhow!("invalid libpython info"))?;
|
||||||
let lib_path = std::path::PathBuf::from(lib_path);
|
let lib_path = std::path::PathBuf::from(lib_path.trim());
|
||||||
|
|
||||||
if !lib_path.exists() {
|
if !lib_path.exists() {
|
||||||
anyhow::bail!("library path doesn't exist: {lib_path:?}");
|
anyhow::bail!("library path doesn't exist: {lib_path:?}");
|
||||||
|
|
@ -1138,7 +1138,7 @@ fn get_python_env_info(state: &State) -> Result<(String, std::path::PathBuf, CSt
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
version.to_owned(),
|
version.trim().to_owned(),
|
||||||
lib_path,
|
lib_path,
|
||||||
CString::new(python_exe.as_os_str().as_encoded_bytes())?,
|
CString::new(python_exe.as_os_str().as_encoded_bytes())?,
|
||||||
))
|
))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue