9251:e0f98cc25bf5 | 9252:32dd11232e06 |
---|---|
268 | 268 |
269 def sep(s): | 269 def sep(s): |
270 """Find the path separator used in this string, or os.sep if none.""" | 270 """Find the path separator used in this string, or os.sep if none.""" |
271 sep_match = re.search(r"[\\/]", s) | 271 sep_match = re.search(r"[\\/]", s) |
272 if sep_match: | 272 if sep_match: |
273 the_sep = sep_match.group(0) | 273 the_sep = sep_match[0] |
274 else: | 274 else: |
275 the_sep = os.sep | 275 the_sep = os.sep |
276 return the_sep | 276 return the_sep |
277 | 277 |
278 | 278 |
385 | 385 |
386 """ | 386 """ |
387 for regex, result in self.aliases: | 387 for regex, result in self.aliases: |
388 m = regex.match(path) | 388 m = regex.match(path) |
389 if m: | 389 if m: |
390 new = path.replace(m.group(0), result) | 390 new = path.replace(m[0], result) |
391 new = new.replace(sep(path), sep(result)) | 391 new = new.replace(sep(path), sep(result)) |
392 if not self.relative: | 392 if not self.relative: |
393 new = canonical_filename(new) | 393 new = canonical_filename(new) |
394 return new | 394 return new |
395 return path | 395 return path |