diff options
Diffstat (limited to 'typarichive.py')
| -rw-r--r-- | typarichive.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/typarichive.py b/typarichive.py index 7a48701..80d5cbf 100644 --- a/typarichive.py +++ b/typarichive.py @@ -26,21 +26,21 @@ import re import shutil -def new_font_name(filename): - time_string = datetime.now().strftime('%Y%m%d%H%M') - +def new_font_name(filename, time_string): return re.sub(r'\d{12}', time_string, filename) font = Glyphs.font filepath = font.filepath +time_string = datetime.now().strftime('%Y%m%d%H%M') font_directory = path.dirname(filepath) archive_directory = path.join(font_directory, '_archive') new_font_path = path.join( font_directory, new_font_name( - path.basename(filepath))) + path.basename(filepath), + time_string)) shutil.copy2(filepath, new_font_path) @@ -49,4 +49,6 @@ shutil.move(filepath, archive_directory) font.close() Glyphs.open(new_font_path) -Glyphs.font.familyName = new_font_name(Glyphs.font.familyName) +Glyphs.font.familyName = new_font_name( + Glyphs.font.familyName, + time_string) |
