Fix GUI tree on Windows must have case insensitive keys

This commit is contained in:
Orsiris de Jong 2023-01-26 12:32:32 +01:00
parent d1d60f00fe
commit 6572aecc18

View file

@ -159,6 +159,10 @@ def _make_treedata_from_json(ls_result: List[dict]) -> sg.TreeData:
for entry in ls_result:
# Make sure we drop the prefix '/' so sg.TreeData does not get an empty root
entry["path"] = entry["path"].lstrip("/")
if os.name == 'nt':
# On windows, we need to make sure tree keys don't get duplicate because of lower/uppercase
# Shown filenames aren't affected by this
entry["path"] = entry["path"].lower()
parent = os.path.dirname(entry["path"])
# Make sure we normalize mtime, and remove microseconds