Skip to content

Commit

Permalink
chore: up
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Nov 24, 2024
1 parent 8ca3194 commit cdfda96
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/linux.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::AutoLaunch;
use crate::Result;
use std::fs;
use std::io::Write;
use std::path::PathBuf;
use crate::{AutoLaunch, Result};
use std::{fs, io::Write, path::PathBuf};

/// Linux implement
impl AutoLaunch {
Expand Down Expand Up @@ -47,7 +44,13 @@ impl AutoLaunch {

let dir = get_dir();
if !dir.exists() {
fs::create_dir(&dir)?;
fs::create_dir_all(&dir).or_else(|e| {
if e.kind() == std::io::ErrorKind::AlreadyExists {
Ok(())
} else {
Err(e)
}
})?;
}
let mut file = fs::OpenOptions::new()
.write(true)
Expand Down

0 comments on commit cdfda96

Please sign in to comment.