@@ -141,11 +141,10 @@ def create_archive(
141141
142142 :param backend: the backend to export from. If not specified, the default backend is used.
143143
144- :param tmp_dir: Directory to use for temporary files during archive creation.
145- If not specified, a temporary directory will be created in the same directory as the output file
146- with a '.aiida-export-' prefix. This parameter is useful when the output directory has limited
147- space or when you want to use a specific filesystem (e.g., faster storage) for temporary operations.
148- The directory must exist and be writable.
144+ :param tmp_dir: Location where the temporary directory will be written during archive creation.
145+ The directory must exist and be writable, and defaults to the parent directory of the output file.
146+ This parameter is useful when the output directory has limited space or when you want to use a specific
147+ filesystem (e.g., faster storage) for temporary operations.
149148
150149 :param traversal_rules: graph traversal rules. See :const:`aiida.common.links.GraphTraversalRules`
151150 what rule names are toggleable and what the defaults are.
@@ -289,7 +288,6 @@ def querybuilder():
289288 EXPORT_LOGGER .report (f'Creating archive with:\n { tabulate (count_summary )} ' )
290289
291290 # Handle temporary directory configuration
292- tmp_prefix = '.aiida-export-'
293291 if tmp_dir is not None :
294292 tmp_dir = Path (tmp_dir )
295293 if not tmp_dir .exists ():
@@ -313,7 +311,7 @@ def querybuilder():
313311 # so that the user cannot end up with a half written archive on errors
314312 try :
315313 tmp_dir .mkdir (parents = True , exist_ok = True )
316- with tempfile .TemporaryDirectory (dir = tmp_dir , prefix = tmp_prefix ) as tmpdir :
314+ with tempfile .TemporaryDirectory (dir = tmp_dir , prefix = '.aiida-export-' ) as tmpdir :
317315 tmp_filename = Path (tmpdir ) / 'export.zip'
318316 with archive_format .open (tmp_filename , mode = 'x' , compression = compression ) as writer :
319317 # add metadata
0 commit comments