Skip to content

Commit

Permalink
#50: Check .reg files for ad hoc Wine prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Feb 17, 2021
1 parent 78c0727 commit 7c1b5a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,21 +363,26 @@ pub fn scan_game_for_backup(
#[allow(unused_mut)]
let mut found_registry_keys = std::collections::HashSet::new();

let mut paths_to_check = std::collections::HashSet::<StrictPath>::new();

// Add a dummy root for checking paths without `<root>`.
let mut roots_to_check: Vec<RootsConfig> = vec![RootsConfig {
path: StrictPath::new(SKIP.to_string()),
store: Store::Other,
}];
roots_to_check.extend(roots.iter().cloned());

if let Some(wp) = wine_prefix {
roots_to_check.push(RootsConfig {
path: wp.clone(),
store: Store::OtherWine,
});
paths_to_check.insert(StrictPath::relative(
format!("{}/*.reg", wp.interpret()),
Some(manifest_dir.interpret()),
));
}

let mut paths_to_check = std::collections::HashSet::<StrictPath>::new();

for root in &roots_to_check {
if root.path.raw().trim().is_empty() {
continue;
Expand Down Expand Up @@ -1038,6 +1043,11 @@ mod tests {
size: 0,
original_path: None,
},
ScannedFile {
path: StrictPath::new(format!("{}/tests/wine-prefix/user.reg", repo())),
size: 92,
original_path: None,
},
},
found_registry_keys: hashset! {},
registry_file: None,
Expand Down
4 changes: 4 additions & 0 deletions tests/wine-prefix/user.reg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Ludusavi]
"foo"="bar"

0 comments on commit 7c1b5a1

Please sign in to comment.