From 6ecd5e14fbe921ddb8f0879203076079e0953654 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Wed, 9 Mar 2016 14:43:33 -0500 Subject: [PATCH] fix bugs in chunk change checks --- chunkymap-regen.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/chunkymap-regen.py b/chunkymap-regen.py index f4fb90a..c843bc0 100644 --- a/chunkymap-regen.py +++ b/chunkymap-regen.py @@ -1208,7 +1208,7 @@ class MTChunks: #self.create_chunk_folder(chunky_x, chunky_z) #this_chunk.save_yaml(chunk_yaml_path) #if is_changed: - if not is_dict_subset(self.chunks[chunk_luid].metadata, old_meta, False) # , True, "chunk_yaml_path") + if not is_dict_subset(self.chunks[chunk_luid].metadata, old_meta, False): # , True, "chunk_yaml_path") self.save_chunk_meta(chunky_x, chunky_z) #print(min_indent+"(saved yaml to '"+chunk_yaml_path+"')") if not self.is_save_output_ok: @@ -1581,9 +1581,11 @@ class MTChunks: def correct_genresults_paths(self): count = 0 folder_path = self.get_chunk_genresults_base_path() - for base_path, dirnames, filenames in os.walk(folder_path): - for file_name in filenames: - file_path = os.path.join(folder_path,file_name) + #for base_path, dirnames, filenames in os.walk(folder_path): + for file_name in os.listdir(folder_path): + #for file_name in filenames: + file_path = os.path.join(folder_path,file_name) + if os.path.isfile(file_path): #print (" EXAMINING "+file_name) #badstart_string = "." player_name = None @@ -1603,8 +1605,12 @@ class MTChunks: corrected_file_path = self.get_chunk_genresult_tmp_path(chunky_x, chunky_z) if os.path.isfile(corrected_file_path): os.remove(corrected_file_path) - print(" moving \""+file_path+"\" to \""+corrected_file_path+"\"") - os.rename(file_path, corrected_file_path) + try: + os.rename(file_path, corrected_file_path) + except: + #TODO: why does this happen (file does not exist)??? + print(" Could not finish moving \""+file_path+"\" to \""+corrected_file_path+"\"") + count += 1 else: print("WARNING: found unusable genresults file '"+file_name+"' in ")