Fixed automatic temporary files cleaning with run.py on Windows
This commit is contained in:
parent
ad6929b6a4
commit
565a8dc30d
@ -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):
|
|||||||
# 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):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user