Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix macOS bursting bubbles issue #1367

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/portable/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,25 @@ fn plist_data(name: &str, info: &InstanceInfo) -> anyhow::Result<String> {
))
}

fn create_dir_all_if_not_exists<P: AsRef<fs::Path>>(path: P) -> std::io::Result<()> {
let path = path.as_ref();
if path.exists() {
Ok(())
} else {
fs::create_dir_all(path)
}
}

fn _create_service(info: &InstanceInfo) -> anyhow::Result<()> {
let name = &info.name;

let plist_dir_path = plist_dir()?;
fs::create_dir_all(&plist_dir_path)?;
create_dir_all_if_not_exists(&plist_dir_path)?;
let plist_path = plist_dir_path.join(plist_name(name));
let unit_name = launchd_name(name);
fs::write(&plist_path, plist_data(name, info)?)?;
if let Some(dir) = runstate_dir(name)?.parent() {
fs::create_dir_all(dir)?;
create_dir_all_if_not_exists(dir)?;
}

// Clear the disabled status of the unit name, in case the user disabled
Expand Down
Loading