File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222#include < fstream>
2323#include < mutex>
2424#include < thread>
25+ #include < filesystem>
2526
2627#ifdef _MSC_VER
2728# include < atlbase.h>
@@ -34,20 +35,6 @@ using namespace std;
3435using namespace litecore ;
3536using namespace fleece ;
3637
37- FilePath GetSystemTempDirectory () {
38- #ifdef _MSC_VER
39- WCHAR pathBuffer[MAX_PATH + 1 ];
40- GetTempPathW (MAX_PATH, pathBuffer);
41- GetLongPathNameW (pathBuffer, pathBuffer, MAX_PATH);
42- CW2AEX<256 > convertedPath (pathBuffer, CP_UTF8);
43- return litecore::FilePath (convertedPath.m_psz );
44- #else // _MSC_VER
45- const char * tmp = getenv (" TMPDIR" );
46- if ( !tmp ) tmp = " /tmp" ;
47- return {tmp};
48- #endif // _MSC_VER
49- }
50-
5138FilePath GetTempDirectory () {
5239 static FilePath kTempDir ;
5340 static once_flag f;
@@ -56,7 +43,7 @@ FilePath GetTempDirectory() {
5643 char folderName[bufSize];
5744 snprintf (folderName, bufSize, " LiteCore_Tests_%" PRIms " .cblite2/" ,
5845 chrono::milliseconds (time (nullptr )).count ());
59- kTempDir = GetSystemTempDirectory ()[ folderName] ;
46+ kTempDir = filesystem::temp_directory_path () / folderName;
6047 (void )kTempDir .mkdir (); // it's OK if it already exists
6148 });
6249
You can’t perform that action at this time.
0 commit comments