Filter out more broad paths

This commit is contained in:
mtkennerly 2024-04-21 20:16:03 -04:00
parent 22bae27388
commit c19bea11e5
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
4 changed files with 32 additions and 67 deletions

View file

@ -51,7 +51,7 @@ pub fn normalize(path: &str) -> String {
}
pub fn too_broad(path: &str) -> bool {
use placeholder::{BASE, HOME, ROOT, STORE_USER_ID, WIN_DIR, WIN_DOCUMENTS, XDG_CONFIG, XDG_DATA};
use placeholder::{BASE, HOME, ROOT, STORE_USER_ID, WIN_APP_DATA, WIN_DIR, WIN_DOCUMENTS, XDG_CONFIG, XDG_DATA};
for item in placeholder::ALL {
if path == *item {
@ -59,6 +59,12 @@ pub fn too_broad(path: &str) -> bool {
}
}
for item in placeholder::AVOID_WILDCARDS {
if path.starts_with(&format!("{item}/*")) {
return true;
}
}
// These paths are present whether or not the game is installed.
// If possible, they should be narrowed down on the wiki.
for item in [
@ -73,8 +79,11 @@ pub fn too_broad(path: &str) -> bool {
format!("{HOME}/Documents/My Games"),
format!("{HOME}/Library/Application Support"),
format!("{HOME}/Library/Preferences"),
format!("{HOME}/.renpy"),
format!("{HOME}/Library/RenPy"),
format!("{HOME}/Telltale Games"),
format!("{ROOT}/config"),
format!("{WIN_APP_DATA}/RenPy"),
format!("{WIN_DIR}/win.ini"),
format!("{WIN_DIR}/SysWOW64"),
format!("{WIN_DOCUMENTS}/My Games"),