comparison pytouhou/ui/music.pyx @ 474:ca22df9e70bc

Fix a crash when handling non-ascii paths
author Thibaut Girka <thib@sitedethib.com>
date Fri, 27 Sep 2013 18:02:04 +0200
parents 6864a38b2413
children 4778c482f24a
comparison
equal deleted inserted replaced
473:1c891c71cf22 474:ca22df9e70bc
33 track = resource_loader.get_track(posname) 33 track = resource_loader.get_track(posname)
34 except KeyError: 34 except KeyError:
35 self.bgms.append(None) 35 self.bgms.append(None)
36 logger.warn(u'Music description ā€œ%sā€ not found.', posname) 36 logger.warn(u'Music description ā€œ%sā€ not found.', posname)
37 continue 37 continue
38 globname = join(resource_loader.game_dir, bgm[1]).replace('.mid', '.*') 38 globname = join(resource_loader.game_dir, bgm[1].encode('ascii')).replace('.mid', '.*')
39 filenames = glob(globname) 39 filenames = glob(globname)
40 for filename in reversed(filenames): 40 for filename in reversed(filenames):
41 try: 41 try:
42 source = sdl.load_music(filename) 42 source = sdl.load_music(filename)
43 except sdl.SDLError as error: 43 except sdl.SDLError as error: