Add missing UTF8 version of do_stat().
authorCarl Hetherington <cth@carlh.net>
Sat, 16 Mar 2024 20:16:17 +0000 (21:16 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 21 Mar 2024 19:25:17 +0000 (20:25 +0100)
src/KM_fileio.cpp

index 4d50722d753308cca9e4b7b199b44edc8a569c2b..2d3fd2781381ac79580c4a030f25fcd9070e2682 100644 (file)
@@ -95,7 +95,13 @@ do_stat(const char* path, fstat_t* stat_info)
 #ifdef KM_WIN32
   UINT prev = ::SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
 
+#ifdef KM_WIN32_UTF8
+  ByteString wb_filename;
+  Result_t result = utf8_to_wbstr(path, wb_filename);
+  if ( _wstati64((wchar_t*)wb_filename.RoData(), stat_info) == (__int64)-1 )
+#else
   if ( _stati64(path, stat_info) == (__int64)-1 )
+#endif
     result = Kumu::RESULT_FILEOPEN;
 
   ::SetErrorMode( prev );