From 696057e45fbea1c00a66ac9d5476bf80924c16a9 Mon Sep 17 00:00:00 2001 From: Michal S Date: Sat, 20 Aug 2022 22:05:58 +0100 Subject: [PATCH] Betterised prompt --- src/internal/initialise.rs | 33 +++++---------------------------- src/operations/aur_install.rs | 2 +- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/internal/initialise.rs b/src/internal/initialise.rs index a89385c..8554f20 100644 --- a/src/internal/initialise.rs +++ b/src/internal/initialise.rs @@ -8,41 +8,18 @@ pub fn init(options: Options) { let verbosity = options.verbosity; let homedir = env::var("HOME").unwrap(); - // If cache path doesn't exist, create it, if it does, delete it and recreate it - if !Path::new(&format!("{}/.cache/ame/", homedir)).exists() { + // If stateful dir doesn't exist, create it + if !Path::new(&format!("{}/.local/share/ame/", homedir)).exists() { if verbosity >= 1 { - log!("Initialising cache directory"); + log!("Initialising stateful directory"); } - std::fs::create_dir_all(format!("{}/.cache/ame", homedir)).unwrap_or_else(|e| { + std::fs::create_dir_all(format!("{}/.local/share/ame", homedir)).unwrap_or_else(|e| { crash!( AppExitCode::FailedCreatingPaths, - "Couldn't create path: {}/.cache/ame: {}", + "Couldn't create path: {}/.local/share/ame: {}", homedir, e, ); }); - } else { - if verbosity >= 1 { - log!("Deleting cache directory"); - } - rm_rf::remove(format!("{}/.cache/ame", homedir)).unwrap_or_else(|e| { - crash!( - AppExitCode::FailedCreatingPaths, - "Couldn't remove path: {}/.cache/ame: {}", - homedir, - e - ) - }); - if verbosity >= 1 { - log!("Creating cache directory"); - } - std::fs::create_dir_all(format!("{}/.cache/ame", homedir)).unwrap_or_else(|e| { - crash!( - AppExitCode::FailedCreatingPaths, - "Couldn't create path: {}/.cache/ame: {}", - homedir, - e - ) - }); } } diff --git a/src/operations/aur_install.rs b/src/operations/aur_install.rs index dfe9b16..5f317c9 100644 --- a/src/operations/aur_install.rs +++ b/src/operations/aur_install.rs @@ -180,7 +180,7 @@ pub fn aur_install(a: Vec, options: Options, cachedir: String) { let cdir = env::current_dir().unwrap().to_str().unwrap().to_string(); set_current_dir(Path::new(&format!("{}/{}", &cachedir, pkg))).unwrap(); - Command::new("bash").spawn().unwrap().wait().unwrap(); + ShellCommand::bash().wait().unwrap(); set_current_dir(Path::new(&cdir)).unwrap();