efbb: Use mkstemp to create temporary file
SVN revision: 76564
This commit is contained in:
parent
775027a169
commit
7a7546b317
|
@ -12,6 +12,7 @@ import sys
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import tempfile
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,8 +60,8 @@ def eet_struct_write(f, struct):
|
||||||
|
|
||||||
|
|
||||||
def eet_desc_write(levels):
|
def eet_desc_write(levels):
|
||||||
tmp_filename = '/tmp/game_levels.desc'
|
fd, tmp_filename = tempfile.mkstemp()
|
||||||
f = open(tmp_filename, 'w')
|
f = os.fdopen(fd, 'w')
|
||||||
r = eet_struct_write(f, levels)
|
r = eet_struct_write(f, levels)
|
||||||
f.close()
|
f.close()
|
||||||
if r:
|
if r:
|
||||||
|
@ -241,6 +242,7 @@ def main(root, eet_filename):
|
||||||
desc_filename = eet_desc_write(levels)
|
desc_filename = eet_desc_write(levels)
|
||||||
if desc_filename:
|
if desc_filename:
|
||||||
eet_create(desc_filename, eet_filename)
|
eet_create(desc_filename, eet_filename)
|
||||||
|
os.unlink(desc_filename)
|
||||||
print "Done! File %s created with success." % eet_filename
|
print "Done! File %s created with success." % eet_filename
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue