From 9a85714df774cfc70d926acf25e58b6b5887a702 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 24 Sep 2020 14:18:23 -0700 Subject: [PATCH] Use pathclass.Path.makedirs. --- etiquette/objects.py | 4 ++-- etiquette/photodb.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etiquette/objects.py b/etiquette/objects.py index ba8b66e..4b32ed1 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -901,7 +901,7 @@ class Photo(ObjectBase): folder = os.sep.join(folder) folder = self.photodb.thumbnail_directory.join(folder) if folder: - os.makedirs(folder.absolute_path, exist_ok=True) + folder.makedirs(exist_ok=True) hopeful_filepath = folder.with_child(basename + '.jpg') return hopeful_filepath @@ -1101,7 +1101,7 @@ class Photo(ObjectBase): self.photodb.log.debug('Renaming file "%s" -> "%s"', old_path.absolute_path, new_path.absolute_path) - os.makedirs(new_path.parent.absolute_path, exist_ok=True) + new_path.parent.makedirs(exist_ok=True) # The plan is to make a hardlink now, then delete the original file # during commit. This only applies to normcase != normcase, because on diff --git a/etiquette/photodb.py b/etiquette/photodb.py index efae72a..8e58a78 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -1713,7 +1713,7 @@ class PhotoDB( msg = f'"{self.database_filepath.absolute_path}" does not exist and create is off.' raise FileNotFoundError(msg) - os.makedirs(self.data_directory.absolute_path, exist_ok=True) + self.data_directory.makedirs(exist_ok=True) self.sql = sqlite3.connect(self.database_filepath.absolute_path) if existing_database: @@ -1725,7 +1725,7 @@ class PhotoDB( # THUMBNAIL DIRECTORY self.thumbnail_directory = self.data_directory.with_child(constants.DEFAULT_THUMBDIR) - os.makedirs(self.thumbnail_directory.absolute_path, exist_ok=True) + self.thumbnail_directory.makedirs(exist_ok=True) # CONFIG self.config_filepath = self.data_directory.with_child(constants.DEFAULT_CONFIGNAME)