.
This commit is contained in:
1 parent
206ed00935
commit
06304dfc7d
6 files changed
+33
-6
No files matched your search
@@ -1,4 +1,6 @@
|
||||
use rusqlite::Connection;
|
||||
use std::{env, path::PathBuf};
|
||||
use std::fs;
|
||||
|
||||
#[path = "note.rs"]
|
||||
mod note;
|
||||
@@ -6,7 +8,10 @@ use note::Note;
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_notes_list(search: &str) -> Vec<Note> {
|
||||
let conn = Connection::open("notes.db").expect("Failed to open database");
|
||||
let app_dir = PathBuf::from(env::var("HOME").unwrap_or_else(|_| ".".into()))
|
||||
.join(".notesapp");
|
||||
fs::create_dir_all(&app_dir).expect("Failed to create app dir");
|
||||
let conn = Connection::open(app_dir.join("notes.db")).expect("Failed to open database");
|
||||
|
||||
conn.execute(
|
||||
"CREATE TABLE IF NOT EXISTS notes
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#[derive(serde::Serialize)]
|
||||
#[derive(serde::Serialize)]
|
||||
pub struct Note {
|
||||
pub id: u32,
|
||||
pub title: String,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
{
|
||||
"title": "Notes",
|
||||
"transparent": true,
|
||||
"width": 950,
|
||||
"width": 1100,
|
||||
"height": 600,
|
||||
"minWidth": 800,
|
||||
"minHeight": 500
|
||||
|
||||
Reference in new issue
Block a user