title: In Python, how can I get the correctly-cased path for a file?
body: <p>Windows uses case-insensitive file names, so I can open the same file with any of these:</p>
  
  <pre><code>r"c:\windows\system32\desktop.ini"
  r"C:\WINdows\System32\DESKTOP.ini"
  r"C:\WiNdOwS\SyStEm32\DeSkToP.iNi"
  </code></pre>
  
  <p>etc.  Given any of these paths, how can I find the true case?  I want them all to produce:</p>
  
  <pre><code>r"C:\Windows\System32\desktop.ini"
  </code></pre>
  
  <p><code>os.path.normcase</code> doesn't do it, it simply lowercases everything. <code>os.path.abspath</code> returns an absolute path, but each of these is already absolute, and so it doesn't change any of them.  <code>os.path.realpath</code> is only used to resolve symbolic links, which Windows doesn't have, so it's the same as abspath on Windows.</p>
  
  <p>Is there a straightforward way to do this? </p>