What is the orignial intent of this line anyway?  It seems to be worse
than os.path.join because it doesn't take into account the slashing of
the current system, and it also
doesn't fully split the string.

>>> print "/".join(os.path.split(r"C:\foobar\foobaz"))
C:\foobar/foobaz


Perhaps they meant something like:
dirpath.replace("\\", "/") ?

It seems like they're trying to normalize paths to me.
>>> print r"C:\foobar\foobaz".replace("\\", "/")
C:/foobar/foobaz

thoughts?
-Luke
On Mon, Sep 6, 2010 at 1:33 PM, Bruce Smith <[email protected]> wrote:
> FYI, I didn't review this in any way, but I entered it
> as http://code.google.com/p/pyglet/issues/detail?id=492 so it's not lost.
> - Bruce Smith
>
> On Mon, Aug 30, 2010 at 3:10 PM, mdg583 <[email protected]> wrote:
>>
>> bug:
>>
>> If a file in a resource path is in a directory, it isn't found.
>>
>> in resource.py, there is a line like this:
>> dirpath = '/'.join(os.path.split(dirpath))
>>
>> Normally, this only puts forward slashes between the path elements.
>> However, if the directory path is only one layer (e.g. dirpath has no
>> '/'), then os.path.split still splits it into a list of size 2, with
>> the first element empty (http://docs.python.org/library/
>> os.path.html#os.path.split). As a result, '/'.join puts a / at the
>> beginning of the path, which keeps resources from being found.
>>
>> I did this to fix it:
>>
>> plist = os.path.split(dirpath)
>> if len(plist) == 2 and len(plist[0]) == 0:
>>        plist = plist[1:]
>> dirpath = '/'.join(plist)
>>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" 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/pyglet-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" 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/pyglet-users?hl=en.

Reply via email to