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

Function get_complete_file_path

web/pgadmin/utils/__init__.py:234–266  ·  view source on GitHub ↗

Args: file: File returned by file manager Returns: Full path for the file

(file, validate=True)

Source from the content-addressed store, hash-verified

232
233
234def get_complete_file_path(file, validate=True):
235 """
236 Args:
237 file: File returned by file manager
238
239 Returns:
240 Full path for the file
241 """
242 if not file:
243 return None
244
245 # If desktop mode
246 if current_app.PGADMIN_RUNTIME or not current_app.config['SERVER_MODE']:
247 return file if os.path.isfile(file) else None
248
249 # get dir name and file name
250 dir_name, file = get_directory_and_file_name(file)
251
252 storage_dir = get_storage_directory(shared_storage=dir_name) if dir_name \
253 else get_storage_directory()
254 if storage_dir:
255 file = os.path.join(
256 storage_dir,
257 file.lstrip('/').lstrip('\\')
258 )
259 if IS_WIN:
260 file = file.replace('\\', '/')
261 file = fs_short_path(file)
262
263 if validate:
264 return file if os.path.isfile(file) else None
265 else:
266 return file
267
268
269def filename_with_file_manager_path(_file, create_file=False,

Callers 11

connectMethod · 0.90
get_connectionMethod · 0.90
set_env_variablesFunction · 0.90
connectMethod · 0.90
create_ssh_tunnelMethod · 0.90
save_application_stateFunction · 0.90
get_application_stateFunction · 0.90
get_tool_dataFunction · 0.90
current_storage_dirMethod · 0.90
set_env_variablesMethod · 0.90

Calls 4

get_storage_directoryFunction · 0.85
fs_short_pathFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected