1259 |
1259 |
1260 @param fn filename (string) |
1260 @param fn filename (string) |
1261 @return the converted filename (string) |
1261 @return the converted filename (string) |
1262 """ |
1262 """ |
1263 if os.path.isabs(fn): |
1263 if os.path.isabs(fn): |
|
1264 if sys.version_info[0] == 2: |
|
1265 fn = fn.decode(sys.getfilesystemencoding()) |
|
1266 |
1264 return fn |
1267 return fn |
1265 |
1268 |
1266 # Check the cache. |
1269 # Check the cache. |
1267 if fn in self._fncache: |
1270 if fn in self._fncache: |
1268 return self._fncache[fn] |
1271 return self._fncache[fn] |
1271 for p in sys.path: |
1274 for p in sys.path: |
1272 afn = os.path.abspath(os.path.join(p, fn)) |
1275 afn = os.path.abspath(os.path.join(p, fn)) |
1273 nafn = os.path.normcase(afn) |
1276 nafn = os.path.normcase(afn) |
1274 |
1277 |
1275 if os.path.exists(nafn): |
1278 if os.path.exists(nafn): |
|
1279 if sys.version_info[0] == 2: |
|
1280 afn = afn.decode(sys.getfilesystemencoding()) |
|
1281 |
1276 self._fncache[fn] = afn |
1282 self._fncache[fn] = afn |
1277 d = os.path.dirname(afn) |
1283 d = os.path.dirname(afn) |
1278 if (d not in sys.path) and (d not in self.dircache): |
1284 if (d not in sys.path) and (d not in self.dircache): |
1279 self.dircache.append(d) |
1285 self.dircache.append(d) |
1280 return afn |
1286 return afn |