mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-05 07:17:52 +10:00
fix LIB_DIR and TMP_DIR loading when primary option isnt available
This commit is contained in:
@@ -510,7 +510,7 @@ def log_removal_finished(all_links: int, to_remove: int):
|
||||
### Helpers
|
||||
|
||||
@enforce_types
|
||||
def pretty_path(path: Union[Path, str], pwd: Union[Path, str]=DATA_DIR) -> str:
|
||||
def pretty_path(path: Union[Path, str], pwd: Union[Path, str]=DATA_DIR, color: bool=True) -> str:
|
||||
"""convert paths like .../ArchiveBox/archivebox/../output/abc into output/abc"""
|
||||
pwd = str(Path(pwd)) # .resolve()
|
||||
path = str(path)
|
||||
@@ -520,7 +520,10 @@ def pretty_path(path: Union[Path, str], pwd: Union[Path, str]=DATA_DIR) -> str:
|
||||
|
||||
# replace long absolute paths with ./ relative ones to save on terminal output width
|
||||
if path.startswith(pwd) and (pwd != '/') and path != pwd:
|
||||
path = path.replace(pwd, '[light_slate_blue].[/light_slate_blue]', 1)
|
||||
if color:
|
||||
path = path.replace(pwd, '[light_slate_blue].[/light_slate_blue]', 1)
|
||||
else:
|
||||
path = path.replace(pwd, '.', 1)
|
||||
|
||||
# quote paths containing spaces
|
||||
if ' ' in path:
|
||||
|
||||
Reference in New Issue
Block a user