Replace Win32 file IO with UWP safe variants and add support for getting drives to UWP build (#15652)

* replace, all win32 file io with their matching uwp safe variants

* add support for drive listing

* Delete NATIVEAPP.ipch

* Update .gitignore

* fix indentation
This commit is contained in:
tunip3
2022-07-06 23:59:47 +02:00
committed by GitHub
parent f6676fd706
commit 42ae18eea5
8 changed files with 90 additions and 11 deletions
+5 -2
View File
@@ -50,6 +50,9 @@
#ifdef _WIN32
#include "Common/CommonWindows.h"
#include <sys/stat.h>
#if PPSSPP_PLATFORM(UWP)
#include <fileapifromapp.h>
#endif
#undef FILE_OPEN
#else
#include <dirent.h>
@@ -158,7 +161,7 @@ bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, File
// Let's do it!
#if PPSSPP_PLATFORM(UWP)
hFile = CreateFile2(fullName.ToWString().c_str(), desired, sharemode, openmode, nullptr);
hFile = CreateFile2FromAppW(fullName.ToWString().c_str(), desired, sharemode, openmode, nullptr);
#else
hFile = CreateFile(fullName.ToWString().c_str(), desired, sharemode, 0, openmode, 0, 0);
#endif
@@ -170,7 +173,7 @@ bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, File
// Sometimes, the file is locked for write, let's try again.
sharemode |= FILE_SHARE_WRITE;
#if PPSSPP_PLATFORM(UWP)
hFile = CreateFile2(fullName.ToWString().c_str(), desired, sharemode, openmode, nullptr);
hFile = CreateFile2FromAppW(fullName.ToWString().c_str(), desired, sharemode, openmode, nullptr);
#else
hFile = CreateFile(fullName.ToWString().c_str(), desired, sharemode, 0, openmode, 0, 0);
#endif