From 565a8dc30dd1db3799ff6f4ca4543f4100240d1e Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Mon, 2 Jul 2012 12:23:57 +0000 Subject: [PATCH] Fixed automatic temporary files cleaning with run.py on Windows --- modules/core/src/system.cpp | 2 +- modules/ts/misc/run.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index 8a78faf..fc4dced 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -478,7 +478,7 @@ string tempfile( const char* suffix ) char temp_file[MAX_PATH + 1] = { 0 }; ::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(); string name = temp_file; diff --git a/modules/ts/misc/run.py b/modules/ts/misc/run.py index cac280b..16fa241 100644 --- a/modules/ts/misc/run.py +++ b/modules/ts/misc/run.py @@ -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): -- 2.7.4