fix tmp data dir resolution when running help or version outside data dir

This commit is contained in:
Nick Sweeting 2024-10-04 01:40:41 -07:00
parent f321d25f4c
commit 12f32c4690
No known key found for this signature in database
12 changed files with 30 additions and 208 deletions
archivebox/misc

View file

@ -111,10 +111,10 @@ def atomic_write(path: Union[Path, str], contents: Union[dict, str, bytes], over
os.chmod(path, int(STORAGE_CONFIG.OUTPUT_PERMISSIONS, base=8))
@enforce_types
def chmod_file(path: str, cwd: str='.') -> None:
def chmod_file(path: str, cwd: str='') -> None:
"""chmod -R <permissions> <cwd>/<path>"""
root = Path(cwd) / path
root = Path(cwd or os.getcwd()) / path
if not root.exists():
raise Exception('Failed to chmod: {} does not exist (did the previous step fail?)'.format(path))