Use pathclass.Path.makedirs.
This commit is contained in:
		
							parent
							
								
									28181428be
								
							
						
					
					
						commit
						9a85714df7
					
				
					 2 changed files with 4 additions and 4 deletions
				
			
		|  | @ -901,7 +901,7 @@ class Photo(ObjectBase): | ||||||
|         folder = os.sep.join(folder) |         folder = os.sep.join(folder) | ||||||
|         folder = self.photodb.thumbnail_directory.join(folder) |         folder = self.photodb.thumbnail_directory.join(folder) | ||||||
|         if folder: |         if folder: | ||||||
|             os.makedirs(folder.absolute_path, exist_ok=True) |             folder.makedirs(exist_ok=True) | ||||||
|         hopeful_filepath = folder.with_child(basename + '.jpg') |         hopeful_filepath = folder.with_child(basename + '.jpg') | ||||||
|         return hopeful_filepath |         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) |         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 |         # The plan is to make a hardlink now, then delete the original file | ||||||
|         # during commit. This only applies to normcase != normcase, because on |         # during commit. This only applies to normcase != normcase, because on | ||||||
|  |  | ||||||
|  | @ -1713,7 +1713,7 @@ class PhotoDB( | ||||||
|                 msg = f'"{self.database_filepath.absolute_path}" does not exist and create is off.' |                 msg = f'"{self.database_filepath.absolute_path}" does not exist and create is off.' | ||||||
|                 raise FileNotFoundError(msg) |                 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) |             self.sql = sqlite3.connect(self.database_filepath.absolute_path) | ||||||
| 
 | 
 | ||||||
|         if existing_database: |         if existing_database: | ||||||
|  | @ -1725,7 +1725,7 @@ class PhotoDB( | ||||||
| 
 | 
 | ||||||
|         # THUMBNAIL DIRECTORY |         # THUMBNAIL DIRECTORY | ||||||
|         self.thumbnail_directory = self.data_directory.with_child(constants.DEFAULT_THUMBDIR) |         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 |         # CONFIG | ||||||
|         self.config_filepath = self.data_directory.with_child(constants.DEFAULT_CONFIGNAME) |         self.config_filepath = self.data_directory.with_child(constants.DEFAULT_CONFIGNAME) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue