Windows использует имена, не учитывающие регистр, поэтому я могу открыть один и тот же файл с любым из них:
r"c:\windows\system32\desktop.ini"
r"C:\WINdows\System32\DESKTOP.ini"
r"C:\WiNdOwS\SyStEm32\DeSkToP.iNi"
и т.д.. Учитывая любой из этих путей, как я могу найти истинный случай? Я хочу, чтобы все они производили:
r"C:\Windows\System32\desktop.ini"
os.path.normcase
не делает этого, он просто уменьшает все. os.path.abspath
возвращает абсолютный путь, но каждый из них уже является абсолютным, и поэтому он не меняет ни одного из них. os.path.realpath
используется только для разрешения символических ссылок, которые Windows не имеет, поэтому он аналогичен abspath в Windows.
Есть ли простой способ сделать это?