Defensive cheats folder (#220)

This commit is contained in:
Denis Isidoro 2020-03-10 14:01:28 -03:00 committed by GitHub
parent 44d072de94
commit 751393309f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -130,7 +130,11 @@ fn read_file(
pub fn read_all(config: &Config, stdin: &mut std::process::ChildStdin) -> HashMap<String, Value> {
let mut variables: HashMap<String, Value> = HashMap::new();
let fallback = format!("{}/cheats", filesystem::exe_path_string());
let current_exe = filesystem::exe_path_string();
let fallback = format!(
"{}/cheats:{}/../cheats:{}/../libexec/cheats",
current_exe, current_exe, current_exe
);
let folders_str = config.path.as_ref().unwrap_or(&fallback);
let folders = folders_str.split(':');

View file

@ -20,7 +20,7 @@ fn follow_symlink(pathbuf: PathBuf) -> PathBuf {
}
fn exe_pathbuf() -> PathBuf {
let pathbuf = std::env::current_exe().unwrap().to_path_buf();
let pathbuf = std::env::current_exe().unwrap();
follow_symlink(pathbuf)
}