mirror of
https://github.com/lifegpc/garbro-rs.git
synced 2026-06-06 05:28:46 +08:00
Fix
This commit is contained in:
26
src-tauri/Cargo.lock
generated
26
src-tauri/Cargo.lock
generated
@@ -1815,6 +1815,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-fs",
|
||||
"tauri-plugin-opener",
|
||||
]
|
||||
|
||||
@@ -3457,6 +3458,7 @@ checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"libc",
|
||||
"objc2",
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
@@ -5190,6 +5192,30 @@ dependencies = [
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36e1ec28b79f3d0683f4507e1615c36292c0ea6716668770d4396b9b39871ed8"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"dunce",
|
||||
"glob",
|
||||
"log",
|
||||
"objc2-foundation",
|
||||
"percent-encoding",
|
||||
"schemars 0.8.22",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"tauri-utils",
|
||||
"thiserror 2.0.18",
|
||||
"toml 0.9.12+spec-1.1.0",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-opener"
|
||||
version = "2.5.3"
|
||||
|
||||
@@ -27,4 +27,5 @@ tauri = { version = "2", features = [] }
|
||||
tauri-plugin-opener = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tauri-plugin-fs = "2.5.0"
|
||||
|
||||
|
||||
@@ -5,6 +5,20 @@
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"opener:default"
|
||||
"opener:default",
|
||||
"fs:default",
|
||||
{
|
||||
"identifier": "fs:allow-read",
|
||||
"allow": [{ "path": "**" }]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-write",
|
||||
"allow": [{ "path": "**" }]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-mkdir",
|
||||
"allow": [{ "path": "**" }]
|
||||
},
|
||||
"fs:allow-exists"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -202,7 +202,13 @@ fn detect_file_type(filename: &str, data: &[u8]) -> (EntryType, Option<ScriptTyp
|
||||
fn list_fs_directory(path: &Path) -> Result<Vec<Entry>> {
|
||||
let mut result = Vec::new();
|
||||
for entry in std::fs::read_dir(path)? {
|
||||
let entry = entry?;
|
||||
let entry = match entry {
|
||||
Ok(e) => e,
|
||||
Err(e) => {
|
||||
eprintln!("无法读取目录项: {}", e);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let metadata = entry.metadata()?;
|
||||
let is_dir = metadata.is_dir();
|
||||
let name = entry.file_name().to_string_lossy().to_string();
|
||||
@@ -372,9 +378,13 @@ fn list_archive_directory_in_archive<'a>(
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn set_last_directory(app: &AppHandle, dir: &str) -> Result<()> {
|
||||
let path = app.path().app_data_dir()?.join("last_directory.txt");
|
||||
std::fs::write(path, dir)?;
|
||||
fn set_last_directory(app: &AppHandle, data: &str) -> Result<()> {
|
||||
let dir = app.path().app_data_dir()?;
|
||||
if !dir.exists() {
|
||||
std::fs::create_dir_all(&dir)?;
|
||||
}
|
||||
let path = dir.join("last_directory.txt");
|
||||
std::fs::write(path, data)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ mod backend;
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
backend::get_start_directory,
|
||||
backend::get_xp3_supported_games,
|
||||
|
||||
Reference in New Issue
Block a user