feat: create affine folder in user/document

This commit is contained in:
linonetwo
2023-01-09 10:36:01 +08:00
parent 75c07d9d46
commit 928d878240

View File

@@ -1,6 +1,6 @@
use jwst_storage::{BlobFsStorage, DBContext, DocFsStorage}; use jwst_storage::{BlobFsStorage, DBContext, DocFsStorage};
use std::path::Path; use std::path::Path;
use tauri::api::path::desktop_dir; use tauri::api::path::document_dir;
use tokio::sync::Mutex; use tokio::sync::Mutex;
pub struct AppStateRaw { pub struct AppStateRaw {
@@ -11,16 +11,12 @@ pub struct AppStateRaw {
impl AppStateRaw { impl AppStateRaw {
pub async fn new() -> Option<AppStateRaw> { pub async fn new() -> Option<AppStateRaw> {
let doc_env = Path::new(&desktop_dir()?.into_os_string()) let affine_document_path = Path::new(&document_dir()?.into_os_string()).join("affine");
.join("affine-dev") let doc_env = affine_document_path.join("doc");
.join("doc"); let blob_env = affine_document_path.join("blob");
let blob_env = Path::new(&(desktop_dir()?.into_os_string()))
.join("affine-dev")
.join("blob");
let db_env = format!( let db_env = format!(
"sqlite://{}?mode=rwc", "sqlite://{}?mode=rwc",
Path::new(&(desktop_dir()?.into_os_string())) affine_document_path
.join("affine-dev")
.join("db") .join("db")
.join("metadata.db") .join("metadata.db")
.into_os_string() .into_os_string()