MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / short_filepath

Function short_filepath

web/pgadmin/utils/__init__.py:314–327  ·  view source on GitHub ↗
(file=_file)

Source from the content-addressed store, hash-verified

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.

Callers 1

Calls 3

fs_short_pathFunction · 0.85
dirnameMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected