mirror of
https://github.com/VirtualHotBar/NetMount.git
synced 2026-06-04 18:32:18 +08:00
更新图标尺寸
This commit is contained in:
28
src-tauri/Cargo.lock
generated
28
src-tauri/Cargo.lock
generated
@@ -77,6 +77,7 @@ checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3"
|
||||
name = "app"
|
||||
version = "0.1.4"
|
||||
dependencies = [
|
||||
"directories",
|
||||
"futures-util",
|
||||
"indicatif",
|
||||
"lazy_static",
|
||||
@@ -727,6 +728,15 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "directories"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-next"
|
||||
version = "2.0.0"
|
||||
@@ -737,6 +747,18 @@ dependencies = [
|
||||
"dirs-sys-next",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys-next"
|
||||
version = "0.1.2"
|
||||
@@ -2194,6 +2216,12 @@ dependencies = [
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "option-ext"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||
|
||||
[[package]]
|
||||
name = "os_info"
|
||||
version = "3.8.2"
|
||||
|
||||
@@ -27,7 +27,9 @@ tokio = { version = "1", features = ["full"] }
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.6.1", features = [ "path-all", "macos-private-api",
|
||||
tauri = { version = "1.6.1", features = [
|
||||
"path-all",
|
||||
"macos-private-api",
|
||||
"shell-open",
|
||||
"fs-all",
|
||||
"os-all",
|
||||
@@ -37,6 +39,8 @@ tauri = { version = "1.6.1", features = [ "path-all", "macos-private-api",
|
||||
"window-all",
|
||||
"devtools",
|
||||
] }
|
||||
|
||||
directories = "5.0.1"
|
||||
window-shadows = "0.2.2"
|
||||
|
||||
reqwest = { version = "0.11", features = ["json", "stream"] }
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 35 KiB |
@@ -22,6 +22,7 @@ use crate::autostart::set_autostart;
|
||||
use crate::utils::download_with_progress;
|
||||
#[cfg(target_os = "windows")]
|
||||
use crate::utils::find_first_available_drive_letter;
|
||||
use crate::utils::get_home_dir;
|
||||
#[cfg(target_os = "windows")]
|
||||
use crate::utils::is_winfsp_installed;
|
||||
#[cfg(target_os = "windows")]
|
||||
@@ -31,7 +32,7 @@ use crate::utils::set_window_shadow;
|
||||
//use crate::localized::get_localized_text;
|
||||
use crate::localized::set_localized;
|
||||
|
||||
const CONFIG_PATH: &str = "res/config.json";
|
||||
const CONFIG_PATH: &str = ".netmount_config.json";
|
||||
|
||||
use std::sync::Mutex;
|
||||
|
||||
@@ -48,16 +49,19 @@ fn main() {
|
||||
println!("exe_dir: {}", exe_dir.display());
|
||||
|
||||
let binding = env::current_exe().expect("Failed to get the current executable path");
|
||||
let exe_flie_name =
|
||||
Path::new(&binding)
|
||||
.file_name()
|
||||
.and_then(|s| s.to_str())
|
||||
.unwrap();
|
||||
let exe_flie_name = Path::new(&binding)
|
||||
.file_name()
|
||||
.and_then(|s| s.to_str())
|
||||
.unwrap();
|
||||
|
||||
if !cfg!(debug_assertions) {
|
||||
if cfg!(target_os = "linux") {
|
||||
let resources_dir = exe_dir.parent().expect("无法获取父目录").join("lib").join(exe_flie_name);
|
||||
env::set_current_dir(&resources_dir ).expect("更改工作目录失败");
|
||||
let resources_dir = exe_dir
|
||||
.parent()
|
||||
.expect("无法获取父目录")
|
||||
.join("lib")
|
||||
.join(exe_flie_name);
|
||||
env::set_current_dir(&resources_dir).expect("更改工作目录失败");
|
||||
}
|
||||
|
||||
if cfg!(target_os = "windows") {
|
||||
@@ -154,16 +158,14 @@ use std::path::PathBuf;
|
||||
|
||||
#[tauri::command]
|
||||
fn fs_exist_dir(path: &str) -> bool {
|
||||
// 替换路径中的波浪线 (~) 为用户家目录
|
||||
let home_dir = get_home_dir();
|
||||
// 替换路径中的波浪线 (~) 为用home目录
|
||||
let mut resolved_path = PathBuf::new();
|
||||
if path.starts_with("~") {
|
||||
if let Some(home_dir) = env::home_dir() {
|
||||
|
||||
resolved_path.push(home_dir);
|
||||
resolved_path.push(&path[1..]); // 跳过波浪线
|
||||
} else {
|
||||
eprintln!("Failed to determine home directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
resolved_path.push(path);
|
||||
}
|
||||
@@ -172,16 +174,14 @@ fn fs_exist_dir(path: &str) -> bool {
|
||||
|
||||
#[tauri::command]
|
||||
fn fs_make_dir(path: &str) -> bool {
|
||||
// 替换路径中的波浪线 (~) 为用户家目录
|
||||
let home_dir = get_home_dir();
|
||||
// 替换路径中的波浪线 (~) 为用home目录
|
||||
let mut resolved_path = PathBuf::new();
|
||||
if path.starts_with("~") {
|
||||
if let Some(home_dir) = env::home_dir() {
|
||||
|
||||
resolved_path.push(home_dir);
|
||||
resolved_path.push(&path[1..]); // 跳过波浪线
|
||||
} else {
|
||||
eprintln!("Failed to determine home directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
resolved_path.push(path);
|
||||
}
|
||||
@@ -293,7 +293,8 @@ fn exit_app(app_handle: tauri::AppHandle) {
|
||||
|
||||
#[tauri::command]
|
||||
fn read_config_file() -> Result<Value, String> {
|
||||
let content_result = fs::read_to_string(CONFIG_PATH);
|
||||
let home_dir = get_home_dir();
|
||||
let content_result = fs::read_to_string(home_dir.join(CONFIG_PATH));
|
||||
match content_result {
|
||||
Ok(content) => match serde_json::from_str(&content) {
|
||||
Ok(config) => Ok(config),
|
||||
@@ -305,10 +306,11 @@ fn read_config_file() -> Result<Value, String> {
|
||||
|
||||
#[tauri::command]
|
||||
async fn write_config_file(config_data: Value) -> Result<(), String> {
|
||||
let home_dir = get_home_dir();
|
||||
let pretty_config = to_string_pretty(&config_data)
|
||||
.map_err(|json_error| format!("Failed to serialize JSON: {}", json_error))?;
|
||||
|
||||
fs::write(CONFIG_PATH, pretty_config)
|
||||
fs::write(home_dir.join(CONFIG_PATH), pretty_config)
|
||||
.map_err(|io_error| format!("Failed to write file: {}", io_error))?;
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -113,3 +113,10 @@ pub fn is_winfsp_installed() -> Result<bool, Box<dyn Error>> {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn get_home_dir()-> std::path::PathBuf {
|
||||
use directories::{UserDirs};
|
||||
let user_dirs = UserDirs::new().expect("Failed to get user dirs");
|
||||
user_dirs.home_dir().to_path_buf()
|
||||
}
|
||||
@@ -65,7 +65,7 @@
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"targets": ["nsis","deb","appimage","app","dmg"],
|
||||
"targets":"all",
|
||||
"active": true,
|
||||
"category": "DeveloperTool",
|
||||
"copyright": "",
|
||||
|
||||
Reference in New Issue
Block a user