On Thu, Nov 3, 2011 at 9:51 PM, Edward K. Ream <[email protected]> wrote:
> On Sun, Oct 30, 2011 at 8:50 AM, Edward K. Ream <[email protected]> wrote:
>
>> It appears the problem is in g.os_path_finalize_join.  I'll investigate.
>
> g.os_path_join works; g.os_path_finalize doesn't.   I'll have the fix shortly.

Here is the unit test that reveals the problem, imo::

path1 = r'C:\Python32\Lib\site-packages\leo-editor\leo\core'
path2 = r'\N:Home\PTC_Creo\Creo.wmv'
path3 = r'N:\Home\PTC_Creo\Creo.wmv'

path12 = os.path.join(path1,path2)
path13 = os.path.join(path1,path3)

print(path12,g.os.path.abspath(path12))
print(path13,g.os.path.abspath(path13))

And here is the output::

\N:Home\PTC_Creo\Creo.wmv c:\N:Home\PTC_Creo\Creo.wmv
N:\Home\PTC_Creo\Creo.wmv N:\Home\PTC_Creo\Creo.wmv

The first line shows an improper filename::

c:\N:Home\PTC_Creo\Creo.wmv

the second line show a proper filename::

N:\Home\PTC_Creo\Creo.wmv

That is, on Windows at least:

os.path.abspath(os.path.join(path1,path2))  # bad
os.path.abspath(os.path.join(path1,path3))  # good

In both cases, os.path.join discards path1, but::

os.path.abspath(path12) # bad
os.path.abspath(path13) # good

Thus, on Windows, the following yields a proper file name::

path3 = r'N:\Home\PTC_Creo\Creo.wmv'

while the following yields an improper file name::

path2 = r'\N:Home\PTC_Creo\Creo.wmv'

Because this is is an issue with os.path.abspath, g.os_path_abspath
can not be to blame, as extensive unit testing has shown.

Obviously, the difference between N:\whatever and \N:whatever is hard
to see, but I think it's pretty clear that one works and the other
doesn't, quite independently of Leo.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to