MCPcopy
hub / github.com/flet-dev/flet / __get_upload_dir_path

Function __get_upload_dir_path

sdk/python/packages/flet/src/flet/app.py:534–553  ·  view source on GitHub ↗

Resolve upload directory to an absolute path. Args: upload_dir: Input upload directory path. relative_to_cwd: Resolve relative paths from current working directory instead of current script directory. Returns: Resolved upload directory path or `None

(upload_dir: Optional[str], relative_to_cwd=False)

Source from the content-addressed store, hash-verified

532
533
534def __get_upload_dir_path(upload_dir: Optional[str], relative_to_cwd=False):
535 """
536 Resolve upload directory to an absolute path.
537
538 Args:
539 upload_dir: Input upload directory path.
540 relative_to_cwd: Resolve relative paths from current working directory
541 instead of current script directory.
542
543 Returns:
544 Resolved upload directory path or `None`.
545 """
546
547 if upload_dir and not Path(upload_dir).is_absolute():
548 upload_dir = str(
549 Path(os.getcwd() if relative_to_cwd else get_current_script_dir())
550 .joinpath(upload_dir)
551 .resolve()
552 )
553 return upload_dir

Callers 2

runFunction · 0.85
run_asyncFunction · 0.85

Calls 2

get_current_script_dirFunction · 0.90
PathClass · 0.85

Tested by

no test coverage detected