propagated use of config home path to other systems. file loading now works using rust instead of js

This commit is contained in:
Iaphetes 2025-03-09 09:03:40 +01:00
parent 62918416ee
commit 11bd003298
11 changed files with 1007 additions and 1000 deletions

View file

@ -1,3 +1,4 @@
use crate::get_basepath;
use html_tag::HtmlTag;
use shellexpand;
use std::{
@ -5,11 +6,11 @@ use std::{
path::Path,
};
#[tauri::command]
pub fn dir_tree_html(basepath: &str, filter: Vec<String>) -> String {
match shellexpand::full(basepath) {
Ok(path) => add_dir_tree_node(&Path::new(&path.into_owned()), &filter).to_html(),
Err(_) => String::new(),
pub fn dir_tree_html(app_handle: tauri::AppHandle, filter: Vec<String>) -> String {
if let Some(basepath) = get_basepath(app_handle) {
add_dir_tree_node(&Path::new(&basepath), &filter).to_html()
} else {
String::new()
}
}
fn add_dir_tree_node(path: &Path, filter: &Vec<String>) -> HtmlTag {