| 380 | return parts[-1].partition('.')[0].upper() in self.reserved_names |
| 381 | |
| 382 | def make_uri(self, path): |
| 383 | # Under Windows, file URIs use the UTF-8 encoding. |
| 384 | drive = path.drive |
| 385 | if len(drive) == 2 and drive[1] == ':': |
| 386 | # It's a path on a local drive => 'file:///c:/a/b' |
| 387 | rest = path.as_posix()[2:].lstrip('/') |
| 388 | return 'file:///%s/%s' % ( |
| 389 | drive, urlquote_from_bytes(rest.encode('utf-8'))) |
| 390 | else: |
| 391 | # It's a path on a network drive => 'file://host/share/a/b' |
| 392 | return 'file:' + urlquote_from_bytes( |
| 393 | path.as_posix().encode('utf-8')) |
| 394 | |
| 395 | def gethomedir(self, username): |
| 396 | if 'HOME' in os.environ: |