提交 565a8dc3 编写于 作者: A Andrey Kamaev

Fixed automatic temporary files cleaning with run.py on Windows

上级 ad6929b6
...@@ -478,7 +478,7 @@ string tempfile( const char* suffix ) ...@@ -478,7 +478,7 @@ string tempfile( const char* suffix )
char temp_file[MAX_PATH + 1] = { 0 }; char temp_file[MAX_PATH + 1] = { 0 };
::GetTempPathA(sizeof(temp_dir), temp_dir); ::GetTempPathA(sizeof(temp_dir), temp_dir);
if(0 == ::GetTempFileNameA(temp_dir, "__opencv_temp.", 0, temp_file)) if(0 == ::GetTempFileNameA(temp_dir, "ocv", 0, temp_file))
return string(); return string();
string name = temp_file; string name = temp_file;
......
...@@ -716,13 +716,20 @@ class RunInfo(object): ...@@ -716,13 +716,20 @@ class RunInfo(object):
# clean temporary files # clean temporary files
temp_path = os.environ.get('OPENCV_TEMP_PATH') temp_path = os.environ.get('OPENCV_TEMP_PATH')
if not temp_path: if not temp_path:
if hostos == "nt": if self.targetos == "nt":
temp_path = tempfile.gettempdir() temp_path = tempfile.gettempdir()
else: else:
temp_path = "/tmp" temp_path = "/tmp"
for filename in glob.glob(os.path.join(temp_path, "__opencv_temp.*")) : try:
os.remove( filename ) 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) logpath = os.path.join(workingDir, logfile)
if os.path.isfile(logpath): if os.path.isfile(logpath):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册