2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 03:26:45 +00:00

Path management improvements (#8210)

- Improve path resolution for backup and restore commands
- Closes https://github.com/inventree/InvenTree/issues/8207
This commit is contained in:
Oliver 2024-09-30 10:19:59 +10:00 committed by GitHub
parent a71754b086
commit 73a3e504a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -411,6 +411,11 @@ def backup(c, clean=False, path=None):
cmd = '--noinput --compress -v 2' cmd = '--noinput --compress -v 2'
if path: if path:
# Resolve the provided path
path = Path(path)
if not os.path.isabs(path):
path = localDir().joinpath(path).resolve()
cmd += f' -O {path}' cmd += f' -O {path}'
if clean: if clean:
@ -442,6 +447,11 @@ def restore(
base_cmd = '--noinput --uncompress -v 2' base_cmd = '--noinput --uncompress -v 2'
if path: if path:
# Resolve the provided path
path = Path(path)
if not os.path.isabs(path):
path = localDir().joinpath(path).resolve()
base_cmd += f' -I {path}' base_cmd += f' -I {path}'
if ignore_database: if ignore_database: