Skip to content

Commit

Permalink
Check for existence of fonts dir before backup on Linux. (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
robbixc authored and alichtman committed Jan 15, 2019
1 parent 50965dc commit 0aeec79
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions shallow_backup/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,17 @@ def backup_fonts(backup_path, skip=False):
overwrite_dir_prompt_if_needed(backup_path, skip)
print_blue("Copying '.otf' and '.ttf' fonts...")
fonts_path = get_fonts_dir()
fonts = [quote(os.path.join(fonts_path, font)) for font in os.listdir(fonts_path) if
font.endswith(".otf") or font.endswith(".ttf")]

for font in fonts:
if os.path.exists(font):
copyfile(font, os.path.join(backup_path, font.split("/")[-1]))


if os.path.isdir(fonts_path):
fonts = [quote(os.path.join(fonts_path, font)) for font in os.listdir(fonts_path) if
font.endswith(".otf") or font.endswith(".ttf")]

for font in fonts:
if os.path.exists(font):
copyfile(font, os.path.join(backup_path, font.split("/")[-1]))
else:
print_red ('Skipping fonts backup. No fonts directory found.')


def backup_all(dotfiles_path, packages_path, fonts_path, configs_path, skip=False):
"""
Complete backup procedure.
Expand Down

0 comments on commit 0aeec79

Please sign in to comment.