@@ -73,6 +73,7 @@ def save_decode_result(output_folder: Path, bundle_name: str, decode_result: sou
7373 forbidden_paths : list [str ] = []
7474 renamed_paths : dict [str , str ] = {}
7575 deduplicated : dict [str , str ] = {}
76+ saved_file_contents : dict [Path , str ] = {}
7677
7778 # Папка в который лежит бандл, относительной данной папки, мы и будет сохранять файлы
7879 relative_folder_in_sm = Path (decode_result .sourceMapStatistic ["sourceMapPath" ]).parent
@@ -106,13 +107,34 @@ def save_decode_result(output_folder: Path, bundle_name: str, decode_result: sou
106107 if not saved_file_path .parent .exists ():
107108 saved_file_path .parent .mkdir (parents = True )
108109
109- if saved_file_path .exists ():
110+ saved_file_exists = False
111+ if saved_file_path in saved_file_contents :
112+ saved_file_exists = True
113+ if saved_file_contents [saved_file_path ] == file_content :
114+ print (
115+ "[INFO]" ,
116+ f"Дубликат файла '{ saved_file_path } ' был убран, так как файл уже находится в памяти" ,
117+ )
118+ continue
119+
120+ if not saved_file_exists and saved_file_path .exists ():
121+ saved_file_exists = True
122+ if saved_file_path .read_text () == file_content :
123+ saved_file_contents [saved_file_path ] = file_content
124+ print (
125+ "[INFO]" ,
126+ f"Дубликат файла '{ saved_file_path } ' был убран, так как файл уже находится в файловой системе" ,
127+ )
128+ continue
129+
130+ if saved_file_exists :
110131 old_file_path = str (saved_file_path )
111132 print ("[INFO]" , f"Задублирование файла '{ saved_file_path } '" )
112133
113134 saved_file_path = Path (f"{ saved_file_path } ?dep2" )
114135 deduplicated [old_file_path ] = str (saved_file_path )
115136
137+ saved_file_contents [saved_file_path ] = file_content
116138 saved_file_path .write_text (file_content )
117139
118140 decoder_statistic = DecoderStatistic (
0 commit comments