Fixed automatic temporary files cleaning with run.py on Windows

This commit is contained in:
Andrey Kamaev
2012-07-02 12:23:57 +00:00
parent ad6929b6a4
commit 565a8dc30d
2 changed files with 11 additions and 4 deletions

View File

@@ -716,13 +716,20 @@ class RunInfo(object):
# clean temporary files
temp_path = os.environ.get('OPENCV_TEMP_PATH')
if not temp_path:
if hostos == "nt":
if self.targetos == "nt":
temp_path = tempfile.gettempdir()
else:
temp_path = "/tmp"
for filename in glob.glob(os.path.join(temp_path, "__opencv_temp.*")) :
os.remove( filename )
try:
if self.targetos == "nt":
for filename in glob.glob(os.path.join(temp_path, "ocv*")) :
os.remove( filename )
else:
for filename in glob.glob(os.path.join(temp_path, "__opencv_temp.*")) :
os.remove( filename )
except:
pass
logpath = os.path.join(workingDir, logfile)
if os.path.isfile(logpath):