(filename)
| 238 | return filename |
| 239 | |
| 240 | def _get_path_with_real_case(filename): |
| 241 | # Note: this previously made: |
| 242 | # convert_to_long_pathname(convert_to_short_pathname(filename)) |
| 243 | # but this is no longer done because we can't rely on getting the shortname |
| 244 | # consistently (there are settings to disable it on Windows). |
| 245 | # So, using approach which resolves by listing the dir. |
| 246 | |
| 247 | if "~" in filename: |
| 248 | filename = convert_to_long_pathname(filename) |
| 249 | |
| 250 | if filename.startswith("<") or not os_path_exists(filename): |
| 251 | return filename # Not much we can do. |
| 252 | |
| 253 | drive, parts = os.path.splitdrive(os.path.normpath(filename)) |
| 254 | drive = drive.upper() |
| 255 | while parts.startswith(os.path.sep): |
| 256 | parts = parts[1:] |
| 257 | drive += os.path.sep |
| 258 | parts = parts.lower().split(os.path.sep) |
| 259 | return _resolve_listing_parts(drive, parts, filename) |
| 260 | |
| 261 | # Check that it actually works |
| 262 | _get_path_with_real_case(__file__) |
no test coverage detected