feat: use nostrdb for unix and rocksdb for windows
This commit is contained in:
@@ -96,14 +96,20 @@ fn main() {
|
||||
|
||||
// Create data folder if not exist
|
||||
let home_dir = app.path().home_dir().unwrap();
|
||||
fs::create_dir_all(home_dir.join("Lume/")).unwrap();
|
||||
let _ = fs::create_dir_all(home_dir.join("Lume/"));
|
||||
|
||||
tauri::async_runtime::block_on(async move {
|
||||
// Create nostr database connection
|
||||
let sqlite = SQLiteDatabase::open(home_dir.join("Lume/lume.db")).await;
|
||||
let db_path = home_dir.join(&"Lume/database");
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
let database = NdbDatabase::open(db_path.to_str().unwrap());
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let database = RocksDatabase::open(db_path.to_str().unwrap()).await;
|
||||
|
||||
// Create nostr connection
|
||||
let client = match sqlite {
|
||||
let client = match database {
|
||||
Ok(db) => ClientBuilder::default().database(db).build(),
|
||||
Err(_) => ClientBuilder::default().build(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user