Betterised prompt

i18n
Michal S 2 years ago
parent 57f56aff0e
commit 696057e45f
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -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
)
});
}
}

@ -180,7 +180,7 @@ pub fn aur_install(a: Vec<String>, 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();

Loading…
Cancel
Save