Return abbreviated version of cwd, e.g. d:mydir
()
| 51 | |
| 52 | |
| 53 | def abbrev_cwd(): |
| 54 | """ Return abbreviated version of cwd, e.g. d:mydir """ |
| 55 | cwd = os.getcwd().replace('\\','/') |
| 56 | drivepart = '' |
| 57 | tail = cwd |
| 58 | if sys.platform == 'win32': |
| 59 | if len(cwd) < 4: |
| 60 | return cwd |
| 61 | drivepart,tail = os.path.splitdrive(cwd) |
| 62 | |
| 63 | |
| 64 | parts = tail.split('/') |
| 65 | if len(parts) > 2: |
| 66 | tail = '/'.join(parts[-2:]) |
| 67 | |
| 68 | return (drivepart + ( |
| 69 | cwd == '/' and '/' or tail)) |
no outgoing calls
no test coverage detected