Skip to content

Commit

Permalink
Fix issue that worker doesn't use app data dir for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
parksb committed Feb 4, 2024
1 parent 6e56732 commit a987e9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn main() {
let _ = models::database::migrate(&db);

app.manage(DbState { db: Mutex::new(db) });
worker::start(app);
worker::start(app, &app_data_dir);

Ok(())
})
Expand Down
5 changes: 2 additions & 3 deletions src-tauri/src/worker.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use regex::Regex;
use rusqlite::Connection;
use std::path::PathBuf;
use std::thread;
use std::time;
use tauri::App;
Expand All @@ -13,11 +14,9 @@ use crate::models::settings;
use crate::models::settings::SettingKey;
use crate::producer::create_new_items;

pub fn start(app: &App) {
pub fn start(app: &App, app_data_dir: &PathBuf) {
let app_handle = app.handle();
let app_id = app.config().tauri.bundle.identifier.clone();

let app_data_dir = app_handle.path_resolver().app_data_dir().unwrap();
let db = open_connection(&app_data_dir).unwrap();

thread::spawn(move || loop {
Expand Down

0 comments on commit a987e9a

Please sign in to comment.