<div dir="ltr"><div><div class="gmail_quote">On Sat, Sep 25, 2010 at 1:36 AM, James Y Knight <span dir="ltr"><<a href="mailto:foom@fuhm.net">foom@fuhm.net</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
An OSX code sketch is available here (summary: call FSPathMakeRef to get an FSRef from a path string, then FSRefMakePath to make it back into a path, which will then have the correct case). And note that it only works if the file actually exists.<br>
<br>
<a href="http://stackoverflow.com/questions/370186/how-do-i-find-the-correct-case-of-a-filename" target="_blank">http://stackoverflow.com/questions/370186/how-do-i-find-the-correct-case-of-a-filename</a><br>
<br>
It would indeed be useful to have that be available in Python.<br></blockquote><div><br></div>There is a much simpler way:<div><br></div><div><div><font class="Apple-style-span" face="monospace" size="3"><span class="Apple-style-span" style="font-size: 12px; white-space: pre; "><font class="Apple-style-span" face="arial"><span class="Apple-style-span" style="white-space: normal; font-size: small; "><div>
>>> from Carbon import File</div><div>>>> File.FSRef('/tmp/foo').as_pathname()</div><div>'/private/tmp/Foo'</div><div><br></div><div>Note that this is much slower compared to os.path.exists.</div>
</span></font></span><font class="Apple-style-span" face="arial"></font></font></div></div><div><br></div></div></div></div>