mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-10-03 10:13:34 +10:00
Fix delta updates deleting nested files on Windows (#486)
GameDownloadAgent::run() prunes the install directory by comparing locally-scanned relative paths against the manifest's file_list keys. file_list is always written with `/` separators (see droplet's path_backend.rs), regardless of which OS produced the manifest, but Path::strip_prefix().to_string_lossy() on Windows yields `\`-separated strings. Every nested file therefore fails the exact-string HashMap lookup and gets deleted on every download/update, while flat root files (no separator to disagree on) happen to survive. This is most visible on Unity games, where nearly all content lives under a deeply nested *_Data folder. Confirmed against a live Drop server: 401/407 of a real game's file_list entries contain `/`, with the remaining 6 being separator-less root files, matching exactly which files survive vs. get pruned.
This commit is contained in:
@@ -308,7 +308,7 @@ impl GameDownloadAgent {
|
||||
let current_file_tree = self.scan_filetree(base_path)?;
|
||||
|
||||
for file in current_file_tree {
|
||||
let filename = file.strip_prefix(base_path)?.to_string_lossy().to_string();
|
||||
let filename = file.strip_prefix(base_path)?.to_string_lossy().replace('\\', "/");
|
||||
let needed = file_list.contains_key(&filename) || filename == ".dropdata";
|
||||
if !needed {
|
||||
debug!("deleted {}", file.display());
|
||||
|
||||
Reference in New Issue
Block a user