(file=_file)
| 312 | _file = os.path.join(document_dir(), _file) |
| 313 | |
| 314 | def short_filepath(file=_file): |
| 315 | short_path = fs_short_path(file) |
| 316 | # fs_short_path() function may return empty path on Windows |
| 317 | # if directory doesn't exists. In that case we strip the last path |
| 318 | # component and get the short path. |
| 319 | if os.name == 'nt' and short_path == '': |
| 320 | base_name = os.path.basename(file) |
| 321 | dir_name = os.path.dirname(file) |
| 322 | dir_short_path = fs_short_path(dir_name) |
| 323 | if dir_short_path == '' and file != "": |
| 324 | short_path = os.path.join(short_filepath(dir_name), base_name) |
| 325 | else: |
| 326 | short_path = os.path.join(dir_short_path, base_name) |
| 327 | return short_path |
| 328 | |
| 329 | if create_file: |
| 330 | # Touch the file to get the short path of the file on windows. |
no test coverage detected