1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Fixed relative file hierarchy for backups

This commit is contained in:
Krateng 2020-06-20 18:04:20 +02:00
parent be79dc1888
commit 398b737781

View File

@ -3,6 +3,7 @@ from datetime import datetime
import glob import glob
import os import os
from ...globalconf import datadir from ...globalconf import datadir
from pathlib import PurePath
user_files = { user_files = {
@ -32,4 +33,6 @@ def backup(folder,level="full"):
assert not os.path.exists(archivefile) assert not os.path.exists(archivefile)
with tarfile.open(name=archivefile,mode="x:gz") as archive: with tarfile.open(name=archivefile,mode="x:gz") as archive:
for f in real_files: for f in real_files:
archive.add(f) p = PurePath(f)
r = p.relative_to(datadir())
archive.add(f,arcname=r)