eschneiderSA / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

resource.media() doesn't follow symlinks #465

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a symlink to an assets directory in .
2. try to load an asset through the symlink

Paste in the traceback or error message:
  File "/Users/nornagon/Source/ggj/model.py", line 11, in <module>
    MISSION_ASSIGN_SOUND = resource.media('assets/Mission 
Assigned.wav', streaming=False)
  File "/Library/Python/2.5/site-packages/pyglet/resource.py", line 592, in 
media
    raise ResourceNotFoundException(name)
pyglet.resource.ResourceNotFoundException: Resource "assets/Mission 
Assigned.wav" was not found on the path.  Ensure that the filename has 
the correct captialisation.

Any additional info (platform/language/hardware) that may be relevant?
OS X 10.6, stock Python 2.5

The problem appears to be in Loader.reindex(), which uses os.walk(), which 
doesn't follow symlinks (in order to avoid infinite loops). Suggested fix: 
don't index path, instead load on demand by checking each entry in path in 
reverse order (to yield the same behaviour as current).

Original issue reported on code.google.com by norna...@gmail.com on 3 Feb 2010 at 12:34

GoogleCodeExporter commented 8 years ago
+1 on loading resources on demand or reindex resources explicitly.

Original comment by techtonik@gmail.com on 13 May 2012 at 1:15