|
|
|
@ -423,27 +423,23 @@ string format( const char* fmt, ... ) |
|
|
|
|
|
|
|
|
|
string tempfile( const char* suffix ) |
|
|
|
|
{ |
|
|
|
|
#ifdef HAVE_WINRT |
|
|
|
|
std::wstring temp_dir = L""; |
|
|
|
|
const wchar_t* opencv_temp_dir = _wgetenv(L"OPENCV_TEMP_PATH"); |
|
|
|
|
if (opencv_temp_dir) |
|
|
|
|
temp_dir = std::wstring(opencv_temp_dir); |
|
|
|
|
#else |
|
|
|
|
string fname; |
|
|
|
|
#ifndef HAVE_WINRT |
|
|
|
|
const char *temp_dir = getenv("OPENCV_TEMP_PATH"); |
|
|
|
|
#endif |
|
|
|
|
string fname; |
|
|
|
|
|
|
|
|
|
#if defined WIN32 || defined _WIN32 |
|
|
|
|
#ifdef HAVE_WINRT |
|
|
|
|
RoInitialize(RO_INIT_MULTITHREADED); |
|
|
|
|
std::wstring temp_dir2; |
|
|
|
|
if (temp_dir.empty()) |
|
|
|
|
temp_dir = GetTempPathWinRT(); |
|
|
|
|
std::wstring temp_dir = L""; |
|
|
|
|
const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str(); |
|
|
|
|
if (opencv_temp_dir) |
|
|
|
|
temp_dir = std::wstring(opencv_temp_dir); |
|
|
|
|
|
|
|
|
|
std::wstring temp_file; |
|
|
|
|
temp_file = GetTempFileNameWinRT(L"ocv"); |
|
|
|
|
if (temp_file.empty()) |
|
|
|
|
return std::string(); |
|
|
|
|
return string(); |
|
|
|
|
|
|
|
|
|
temp_file = temp_dir + std::wstring(L"\\") + temp_file; |
|
|
|
|
DeleteFileW(temp_file.c_str()); |
|
|
|
@ -451,7 +447,7 @@ string tempfile( const char* suffix ) |
|
|
|
|
char aname[MAX_PATH]; |
|
|
|
|
size_t copied = wcstombs(aname, temp_file.c_str(), MAX_PATH); |
|
|
|
|
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1)); |
|
|
|
|
fname = std::string(aname); |
|
|
|
|
fname = string(aname); |
|
|
|
|
RoUninitialize(); |
|
|
|
|
#else |
|
|
|
|
char temp_dir2[MAX_PATH] = { 0 }; |
|
|
|
|