Skip to content

Commit d14481d

Browse files
committed
make sure app data folder is definitely created
macos issue
1 parent d9b7a45 commit d14481d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src-tauri/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use log::{error, info, LevelFilter};
2020
// use std::io::Read;
2121
use tauri::Manager;
2222
use tauri::PhysicalSize;
23+
use std::fs;
24+
use tauri::api::path::app_data_dir;
2325

2426
#[path = "deeplink/lib.rs"]
2527
#[cfg(target_os = "windows")]
@@ -161,11 +163,19 @@ Options:
161163
match tauri::Builder::default()
162164
.plugin(tauri_plugin_upload::init())
163165
.setup(|app| {
166+
let handle = app.handle();
164167
let main_window = app.get_window("main").unwrap();
165168
main_window
166169
.set_min_size(Some(PhysicalSize::new(1000, 700)))
167170
.unwrap();
168171

172+
let config = handle.config();
173+
if let Some(path) = app_data_dir(&config) {
174+
if let Err(e) = fs::create_dir_all(&path) {
175+
println!("Failed to create app data directory: {}", e);
176+
}
177+
}
178+
169179
#[cfg(windows)]
170180
{
171181
let handle = app.handle();

0 commit comments

Comments
 (0)