Skip to content

Commit

Permalink
fuck windows update
Browse files Browse the repository at this point in the history
  • Loading branch information
Nissyaniss committed May 23, 2024
1 parent a947ab3 commit 5c17057
Showing 1 changed file with 16 additions and 47 deletions.
63 changes: 16 additions & 47 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,16 @@ struct Config {
impl Default for Config {
fn default() -> Self {
let home_dir: String;
if !cfg!(windows) {
home_dir = match env::var("HOME") {
Ok(home_dir) => home_dir,
Err(e) => {
eprintln!("Error getting home directory. Create the environment variable named $HOME with your home path in it. : {e}");
exit(1);
}
};
let home_dir = PathBuf::from(home_dir);
Self {
path_to_trash: home_dir.join(".local/share/BetterReMove/trash/"),
}
} else if cfg!(windows) {
home_dir = match env::var("UserProfile") {
Ok(home_dir) => home_dir,
Err(e) => {
eprintln!("Error getting home directory. Create the environment variable named UserProfile with your home path in it. : {e}");
exit(1);
}
};
let home_dir = PathBuf::from(home_dir);
Self {
path_to_trash: home_dir.join(r".BetterReMove\trash\"),
home_dir = match env::var("HOME") {
Ok(home_dir) => home_dir,
Err(e) => {
eprintln!("Error getting home directory. Create the environment variable named $HOME with your home path in it. : {e}");
exit(1);
}
} else {
return Self {
path_to_trash: PathBuf::from("null"),
};
};
let home_dir = PathBuf::from(home_dir);
Self {
path_to_trash: home_dir.join(".local/share/BetterReMove/trash/"),
}
}
}
Expand Down Expand Up @@ -103,26 +85,13 @@ fn main() {
let args = Args::parse();
let mut files = args.paths.clone();
let home_dir: String;
if !cfg!(windows) {
home_dir = match env::var("HOME") {
Ok(home_dir) => home_dir,
Err(e) => {
eprintln!("Error getting home directory. Create the environment variable named $HOME with your home path in it. : {e}");
exit(1);
}
};
} else if cfg!(windows) {
home_dir = match env::var("UserProfile") {
Ok(home_dir) => home_dir,
Err(e) => {
eprintln!("Error getting home directory. Create the environment variable named UserProfile with your home path in it. : {e}");
exit(1);
}
};
} else {
eprintln!("Critical error getting home directory.");
exit(1);
}
home_dir = match env::var("HOME") {
Ok(home_dir) => home_dir,
Err(e) => {
eprintln!("Error getting home directory. Create the environment variable named $HOME with your home path in it. : {e}");
exit(1);
}
};

let home_dir = PathBuf::from(home_dir);
let config_file = home_dir.join(".config/BetterReMove/config.toml");
Expand Down

0 comments on commit 5c17057

Please sign in to comment.