@@ -214,34 +214,36 @@ def output(self, value: AnyPathStrType) -> None:
214214 Args:
215215 value (AnyPathStrType): Output path of the set
216216 """
217- # Set the new output
218- self ._output = AnyPath (value )
219- if not path .is_cloud_path (self ._output ):
220- self ._output = self ._output .resolve ()
221-
222- # Create temporary process folder (where to store all temporary files) in the new output folder
223- old_tmp_process = self ._tmp_process
224- self ._set_tmp_process ()
225-
226- # Update output for every mosaics and products composing the set
227- self ._manage_output ()
228-
229- # Move all files from old process folder into the new one
230- if old_tmp_process .exists ():
231- for file in path .listdir_abspath (old_tmp_process ):
232- # Don't overwrite file
233- if file .exists ():
234- with contextlib .suppress (shutil .Error ):
235- shutil .move (str (file ), self ._tmp_process )
236-
237- # Remove old tmp process
238- if old_tmp_process is not None and old_tmp_process .exists ():
239- files .remove (old_tmp_process )
240-
241- # Remove old output if existing into the new output
242- if self ._tmp_output is not None :
243- self ._tmp_output .cleanup ()
244- self ._tmp_output = None
217+ new_output = AnyPath (value )
218+ if self ._output != new_output :
219+ # Set the new output
220+ self ._output = new_output
221+ if not path .is_cloud_path (self ._output ):
222+ self ._output = self ._output .resolve ()
223+
224+ # Create temporary process folder (where to store all temporary files) in the new output folder
225+ old_tmp_process = self ._tmp_process
226+ self ._set_tmp_process ()
227+
228+ # Update output for every mosaics and products composing the set
229+ self ._manage_output ()
230+
231+ # Move all files from old process folder into the new one
232+ if old_tmp_process .exists ():
233+ for file in path .listdir_abspath (old_tmp_process ):
234+ # Don't overwrite file
235+ if file .is_file ():
236+ with contextlib .suppress (shutil .Error ):
237+ shutil .move (str (file ), self ._tmp_process )
238+
239+ # Remove old tmp process
240+ if old_tmp_process is not None and old_tmp_process .exists ():
241+ files .remove (old_tmp_process )
242+
243+ # Remove old output if existing into the new output
244+ if self ._tmp_output is not None :
245+ self ._tmp_output .cleanup ()
246+ self ._tmp_output = None
245247
246248 def _get_tmp_folder (self , writable : bool = False ) -> AnyPathType :
247249 """
0 commit comments