Skip to content

Commit 03934ab

Browse files
committed
fix: 修复 windows SQLite 文件锁导致无法导入备份的问题
1 parent 3db2585 commit 03934ab

File tree

3 files changed

+13
-149
lines changed

3 files changed

+13
-149
lines changed

src-tauri/Cargo.lock

Lines changed: 0 additions & 148 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ url = "2.5"
3737
reqwest_dav = "=0.2.1"
3838
tauri-plugin-opener = "2.4.0"
3939
uuid = { version = "1.10", features = ["v4"] }
40-
zip = "4"
40+
zip = { version = "4", default-features = false, features = ["deflate"] }
4141

4242
[dependencies.tauri-plugin-sql]
4343
features = ["sqlite"]

src-tauri/src/backup.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ pub async fn import_app_data_from_file(
5555
continue;
5656
}
5757

58+
// 跳过 SQLite 临时文件,让数据库重新创建
59+
let file_name_str = file_name.to_string_lossy();
60+
if file_name_str.ends_with(".db-shm") || file_name_str.ends_with(".db-wal") {
61+
continue;
62+
}
63+
5864
let src_path = entry.path();
5965
let dest_path = data_dir.join(&file_name);
6066

@@ -154,6 +160,12 @@ pub async fn import_app_data(app_handle: AppHandle, zip_path: String) -> Result<
154160
continue;
155161
}
156162

163+
// 跳过 SQLite 临时文件,让数据库重新创建
164+
let file_name_str = file_name.to_string_lossy();
165+
if file_name_str.ends_with(".db-shm") || file_name_str.ends_with(".db-wal") {
166+
continue;
167+
}
168+
157169
let src_path = entry.path();
158170
let dest_path = data_dir.join(&file_name);
159171

0 commit comments

Comments
 (0)