mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-18 17:33:30 -05:00
fix: stop calling a held file its own duplicate
This commit is contained in:
1 parent
fd6db086d3
commit
7bd2579022
2 files changed
+24
-3
No files matched your search
+13
-3
@@ -210,9 +210,19 @@ def validate_file(
|
||||
if db:
|
||||
if result.sha1 in db.get("files", {}):
|
||||
existing = db["files"][result.sha1]
|
||||
result.add_warning(
|
||||
f"Duplicate: identical file already exists at `{existing['path']}`"
|
||||
)
|
||||
held_at = {
|
||||
os.path.normpath(p)
|
||||
for p in [existing.get("path"), *(existing.get("paths") or [])] if p
|
||||
}
|
||||
if os.path.normpath(filepath) in held_at:
|
||||
# The file the database was built from, not a copy of it: a
|
||||
# PR that regenerated database.json was told each new file
|
||||
# duplicated itself.
|
||||
result.add_check(True, "Already in the database at this path")
|
||||
else:
|
||||
result.add_warning(
|
||||
f"Duplicate: identical file already exists at `{existing['path']}`"
|
||||
)
|
||||
else:
|
||||
result.add_check(True, "Not a duplicate in database")
|
||||
|
||||
|
||||
Reference in new issue
Block a user