Destination directories now get created when needed
							parent
							
								
									310ac3784e
								
							
						
					
					
						commit
						2660af23d8
					
				|  | @ -45,10 +45,13 @@ class Spec: | ||||||
|             destination if type(destination) == Path else Path(destination) |             destination if type(destination) == Path else Path(destination) | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|         # Check existence of destination folder |         # Create destination if non-existent | ||||||
|         if not self.destination.exists() or not self.destination.is_dir(): |         try: | ||||||
|  |             self.destination.mkdir(parents=True, exist_ok=True) | ||||||
|  | 
 | ||||||
|  |         except FileExistsError: | ||||||
|             raise NotADirectoryError( |             raise NotADirectoryError( | ||||||
|                 "{} doesn't exist or isn't a directory.".format( |                 "{} already exists, but isn't a directory.".format( | ||||||
|                     self.destination |                     self.destination | ||||||
|                 ) |                 ) | ||||||
|             ) |             ) | ||||||
|  |  | ||||||
|  | @ -36,6 +36,6 @@ specs: | ||||||
| 
 | 
 | ||||||
|     directories: |     directories: | ||||||
|         test: |         test: | ||||||
|             destination: "/home/jjr/test" |             destination: "/tmp/to" | ||||||
|             limit: 5 |             limit: 5 | ||||||
|             source: "/home/jjr" |             source: "/tmp/from" | ||||||
|  |  | ||||||
|  | @ -1,14 +0,0 @@ | ||||||
| defaults: |  | ||||||
|     directories: |  | ||||||
|         notify: |  | ||||||
|             title: 'yeet' |  | ||||||
|             events: |  | ||||||
|                 - 'random' |  | ||||||
| 
 |  | ||||||
|         limit: 7 |  | ||||||
| 
 |  | ||||||
| specs: |  | ||||||
|     directories: |  | ||||||
|         test: |  | ||||||
|             source: '/tmp/from' |  | ||||||
|             destination: '/tmp/to' |  | ||||||
		Loading…
	
		Reference in New Issue