fix: path resolver in windows (#5209)
This commit is contained in:
parent
19bcce80fa
commit
c444643294
@ -43,7 +43,7 @@ pub fn join_path<R: Runtime>(
|
||||
}
|
||||
|
||||
let path = resolve_path(app_handle, &args[0]);
|
||||
let joined_path = path.join(args[1..].join("/"));
|
||||
let joined_path = args[1..].iter().fold(path, |acc, part| acc.join(part));
|
||||
Ok(joined_path.to_string_lossy().to_string())
|
||||
}
|
||||
|
||||
@ -136,7 +136,10 @@ fn normalize_file_path(path: &str) -> String {
|
||||
fn resolve_path<R: Runtime>(app_handle: tauri::AppHandle<R>, path: &str) -> PathBuf {
|
||||
let path = if path.starts_with("file:/") || path.starts_with("file:\\") {
|
||||
let normalized = normalize_file_path(path);
|
||||
let relative_normalized = normalized.strip_prefix("/").unwrap_or(&normalized);
|
||||
let relative_normalized = normalized
|
||||
.trim_start_matches(std::path::MAIN_SEPARATOR)
|
||||
.trim_start_matches('/')
|
||||
.trim_start_matches('\\');
|
||||
get_jan_data_folder_path(app_handle).join(relative_normalized)
|
||||
} else {
|
||||
PathBuf::from(path)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user