Skip to content

Commit

Permalink
Create data dir if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNite committed Dec 7, 2023
1 parent bb64079 commit 3fcfcb7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src-tauri/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ pub mod patch;
pub mod update;

pub fn get_data_dir(app_handle: &AppHandle) -> Result<PathBuf, Error> {
app_handle.path_resolver().app_data_dir().ok_or(Error {
let dir = app_handle.path_resolver().app_data_dir().ok_or(Error {
message: "could not get data dir".to_string(),
})
})?;

if !dir.exists() {
std::fs::create_dir_all(&dir)?;
}

Ok(dir)
}

pub fn get_moonlight_dir() -> Result<PathBuf, Error> {
Expand Down

0 comments on commit 3fcfcb7

Please sign in to comment.