File tree 1 file changed +4
-5
lines changed
overviewer_core/aux_files
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 33
33
from overviewer_core import logger
34
34
from overviewer_core import nbt
35
35
from overviewer_core import configParser , world
36
+ from overviewer_core .files import FileReplacer
36
37
37
38
UUID_LOOKUP_URL = 'https://sessionserver.mojang.com/session/minecraft/profile/'
38
39
@@ -233,13 +234,11 @@ def load_cache(cls, outputdir):
233
234
@classmethod
234
235
def save_cache (cls , outputdir ):
235
236
cache_file = os .path .join (outputdir , "uuidcache.dat" )
236
- try :
237
- gz = gzip .GzipFile (cache_file + ".tmp" , "wb" )
237
+
238
+ with FileReplacer (cache_file ) as cache_file_name :
239
+ gz = gzip .GzipFile (cache_file_name , "wb" )
238
240
json .dump (cls .uuid_cache , gz )
239
- os .rename (cache_file + ".tmp" , cache_file )
240
241
logging .info ("Wrote UUID cache with %d entries" , len (cls .uuid_cache .keys ()))
241
- except (IOError , OSError ):
242
- logging .warning ("Failed to save UUID cache!" )
243
242
244
243
def __getitem__ (self , item ):
245
244
if item == "EntityId" :
You can’t perform that action at this time.
0 commit comments