Mercurial > touhou
comparison pytouhou/resource/loader.py @ 297:a09ac4650e0d
Fix relative path handling and os-specific path separators.
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 06 Mar 2012 17:45:14 +0100 |
parents | 2100276c289d |
children | 92a6fd2632f1 |
comparison
equal
deleted
inserted
replaced
296:c074783d0847 | 297:a09ac4650e0d |
---|---|
104 | 104 |
105 | 105 |
106 def scan_archives(self, paths_lists): | 106 def scan_archives(self, paths_lists): |
107 for paths in paths_lists: | 107 for paths in paths_lists: |
108 def _expand_paths(): | 108 def _expand_paths(): |
109 for path in paths.split(':'): | 109 for path in paths.split(os.path.pathsep): |
110 if self.game_dir and not os.path.isabs(path): | 110 if self.game_dir and not os.path.isabs(path): |
111 path = os.path.join(self.game_dir, path) | 111 path = os.path.join(self.game_dir, path) |
112 yield glob(path) | 112 yield glob(path) |
113 paths = list(chain(*_expand_paths())) | 113 paths = list(chain(*_expand_paths())) |
114 path = paths[0] | 114 path = paths[0] |
168 | 168 |
169 | 169 |
170 def get_eosd_characters(self): | 170 def get_eosd_characters(self): |
171 #TODO: Move to pytouhou.games.eosd? | 171 #TODO: Move to pytouhou.games.eosd? |
172 path = self.exe | 172 path = self.exe |
173 if self.game_dir and not os.path.isabs(path): | |
174 path = os.path.join(self.game_dir, path) | |
175 with open(path, 'rb') as file: | 173 with open(path, 'rb') as file: |
176 characters = EoSDSHT.read(file) #TODO: modular | 174 characters = EoSDSHT.read(file) #TODO: modular |
177 return characters | 175 return characters |
178 | 176 |
179 | 177 |