1
0
Fork 0
mirror of https://github.com/Findus23/PaperLibrary-cli.git synced 2024-09-20 17:03:46 +02:00

make bibliography read-only

This commit is contained in:
Lukas Winkler 2023-06-29 15:44:10 +02:00
parent 53c60a22b5
commit bf755f55c7
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -3,6 +3,7 @@ import os
import shutil
from datetime import datetime, timezone
from pathlib import Path
from stat import S_IREAD, S_IRGRP, S_IROTH, S_IWUSR
from alive_progress import alive_bar
from tzlocal import get_localzone
@ -179,5 +180,7 @@ def update_notes(api: PaperLibraryAPI, config: Config):
def write_bibliography(api: PaperLibraryAPI, config: Config):
bib = api.fetch_bibliography()
target_file = config.basedir_path / "bibliography.bib"
target_file.chmod(S_IWUSR | S_IREAD)
with target_file.open("w") as f:
f.write(bib)
target_file.chmod(S_IREAD | S_IRGRP | S_IROTH)