PathExt trait

This commit is contained in:
Roey Darwish Dror
2018-07-07 09:18:53 +03:00
parent 445ad96c10
commit 4c1320f955
5 changed files with 46 additions and 64 deletions

View File

@@ -1,9 +1,8 @@
use super::utils::Check;
use super::utils::{Check, PathExt};
use directories::BaseDirs;
use failure;
use std::env::home_dir;
use std::path::PathBuf;
use std::process::Command;
use utils::is_ancestor;
const EMACS_UPGRADE: &str = include_str!("emacs.el");
@@ -60,8 +59,8 @@ pub fn run_apm(apm: &PathBuf) -> Result<(), failure::Error> {
Ok(())
}
pub fn run_rustup(rustup: &PathBuf) -> Result<(), failure::Error> {
if is_ancestor(&home_dir().unwrap(), &rustup) {
pub fn run_rustup(rustup: &PathBuf, base_dirs: &BaseDirs) -> Result<(), failure::Error> {
if rustup.is_descendant_of(base_dirs.home_dir()) {
Command::new(rustup).args(&["self", "update"]).spawn()?.wait()?.check()?;
}