mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 04:46:18 -05:00
Handling if tagged file does not exist during sync_tags_directory.
This commit is contained in:
parent
0e99266379
commit
27295b8373
1 changed files with 12 additions and 5 deletions
|
|
@ -281,8 +281,13 @@ def _sync_tags_directory_tag_files(tags_directory: pathlib.Path, session: Sessio
|
|||
for file, link in file_group.get_tag_directory_paths_map().items():
|
||||
link = tags_directory / link
|
||||
if not link.is_file():
|
||||
link.parent.mkdir(parents=True, exist_ok=True)
|
||||
link.hardlink_to(file)
|
||||
try:
|
||||
link.parent.mkdir(parents=True, exist_ok=True)
|
||||
link.hardlink_to(file)
|
||||
except FileNotFoundError:
|
||||
logger.error(f'Failed to create link to file because it does not exist: {file}')
|
||||
if PYTEST:
|
||||
raise
|
||||
links.append(link)
|
||||
|
||||
return links
|
||||
|
|
@ -328,10 +333,12 @@ def create_tags_directory(directory: pathlib.Path):
|
|||
directory.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
readme = directory / 'README.txt'
|
||||
readme.write_text('''This directory exists to allow a secondary way to access your tagged files. Files are
|
||||
organized in a directory named after all the Tags they have been tagged with.
|
||||
readme.write_text('''This directory exists to allow a secondary way to access your tagged files.
|
||||
Files are organized in a directory named after all the Tags they have been
|
||||
tagged with.
|
||||
|
||||
WARNING: This directory is controlled by WROLPi, any files you put in here will be automatically deleted!
|
||||
WARNING: This directory is controlled by WROLPi, any files you put in here will
|
||||
be AUTOMATICALLY DELETED!
|
||||
''')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue