mirror of
https://github.com/libretro/RetroArch
synced 2025-02-15 09:40:11 +00:00
strip out unneeded uwp specific file io functions
This commit is contained in:
parent
619df7e11b
commit
8396bd599d
@ -32,6 +32,7 @@
|
|||||||
#include <collection.h>
|
#include <collection.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <fileapifromapp.h>
|
#include <fileapifromapp.h>
|
||||||
|
#include <AclAPI.h>
|
||||||
|
|
||||||
using namespace Windows::Foundation;
|
using namespace Windows::Foundation;
|
||||||
using namespace Windows::Foundation::Collections;
|
using namespace Windows::Foundation::Collections;
|
||||||
@ -56,6 +57,10 @@ using namespace Windows::Storage::FileProperties;
|
|||||||
#include <retro_environment.h>
|
#include <retro_environment.h>
|
||||||
#include <uwp/uwp_async.h>
|
#include <uwp/uwp_async.h>
|
||||||
#include <uwp/uwp_file_handle_access.h>
|
#include <uwp/uwp_file_handle_access.h>
|
||||||
|
#include <uwp/std_filesystem_compat.h>
|
||||||
|
|
||||||
|
// define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to silence warnings
|
||||||
|
// idk why this warning happens considering we can't use the non experimental version but whatever ig
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -734,36 +739,23 @@ int retro_vfs_file_remove_impl(const char *path)
|
|||||||
{
|
{
|
||||||
BOOL result;
|
BOOL result;
|
||||||
wchar_t *path_wide;
|
wchar_t *path_wide;
|
||||||
Platform::String^ path_str;
|
|
||||||
|
|
||||||
if (!path || !*path)
|
if (!path || !*path)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
path_wide = utf8_to_utf16_string_alloc(path);
|
path_wide = utf8_to_utf16_string_alloc(path);
|
||||||
windowsize_path(path_wide);
|
windowsize_path(path_wide);
|
||||||
path_str = ref new Platform::String(path_wide);
|
|
||||||
free(path_wide);
|
|
||||||
|
|
||||||
/* Try Win32 first, this should work in AppData */
|
/* Try Win32 first, this should work in AppData */
|
||||||
result = DeleteFileFromAppW(path_str->Data());
|
result = DeleteFileFromAppW(path_wide);
|
||||||
if (result)
|
if (result)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (GetLastError() == ERROR_FILE_NOT_FOUND)
|
return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Fallback to WinRT */
|
|
||||||
return RunAsyncAndCatchErrors<int>([&]() {
|
|
||||||
return concurrency::create_task(LocateStorageItem<StorageFile>(path_str)).then([&](StorageFile^ file) {
|
|
||||||
return file->DeleteAsync(StorageDeleteOption::PermanentDelete);
|
|
||||||
}).then([&]() {
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
}, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: this may not work if trying to move a directory */
|
/* TODO: this may not work if trying to move a directory */
|
||||||
int retro_vfs_file_rename_impl(const char *old_path, const char *new_path)
|
/*int retro_vfs_file_rename_impl(const char* old_path, const char* new_path)
|
||||||
{
|
{
|
||||||
char new_file_name[PATH_MAX_LENGTH];
|
char new_file_name[PATH_MAX_LENGTH];
|
||||||
char new_dir_path[PATH_MAX_LENGTH];
|
char new_dir_path[PATH_MAX_LENGTH];
|
||||||
@ -800,8 +792,8 @@ int retro_vfs_file_rename_impl(const char *old_path, const char *new_path)
|
|||||||
concurrency::task<StorageFile^> old_file_task = concurrency::create_task(LocateStorageItem<StorageFile>(old_path_str));
|
concurrency::task<StorageFile^> old_file_task = concurrency::create_task(LocateStorageItem<StorageFile>(old_path_str));
|
||||||
concurrency::task<StorageFolder^> new_dir_task = concurrency::create_task(LocateStorageItem<StorageFolder>(new_dir_path_str));
|
concurrency::task<StorageFolder^> new_dir_task = concurrency::create_task(LocateStorageItem<StorageFolder>(new_dir_path_str));
|
||||||
return concurrency::create_task([&] {
|
return concurrency::create_task([&] {
|
||||||
/* Run these two tasks in parallel */
|
// Run these two tasks in parallel
|
||||||
/* TODO: There may be some cleaner way to express this */
|
// TODO: There may be some cleaner way to express this
|
||||||
concurrency::task_group group;
|
concurrency::task_group group;
|
||||||
group.run([&] { return old_file_task; });
|
group.run([&] { return old_file_task; });
|
||||||
group.run([&] { return new_dir_task; });
|
group.run([&] { return new_dir_task; });
|
||||||
@ -812,6 +804,318 @@ int retro_vfs_file_rename_impl(const char *old_path, const char *new_path)
|
|||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
}, -1);
|
}, -1);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//this is enables you to copy access permissions from one file/folder to another
|
||||||
|
//however depending on the target and where the file is being transferred to and from it may not be needed.
|
||||||
|
//(use disgression)
|
||||||
|
int uwp_copy_acl(const wchar_t* source, const wchar_t* target)
|
||||||
|
{
|
||||||
|
PSECURITY_DESCRIPTOR sidOwnerDescriptor = nullptr;
|
||||||
|
PSECURITY_DESCRIPTOR sidGroupDescriptor = nullptr;
|
||||||
|
PSECURITY_DESCRIPTOR daclDescriptor = nullptr;
|
||||||
|
PSID sidOwner;
|
||||||
|
PSID sidGroup;
|
||||||
|
PACL dacl;
|
||||||
|
PACL sacl;
|
||||||
|
DWORD result;
|
||||||
|
HANDLE original_file = CreateFileFromAppW(source, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
|
||||||
|
if (original_file != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
result = GetSecurityInfo(original_file, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, &sidOwner, &sidGroup, &dacl, &sacl, &daclDescriptor);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
LocalFree(daclDescriptor);
|
||||||
|
CloseHandle(original_file);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = GetSecurityInfo(original_file, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION, &sidOwner, &sidGroup, &dacl, &sacl, &sidOwnerDescriptor);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
LocalFree(sidOwnerDescriptor);
|
||||||
|
LocalFree(daclDescriptor);
|
||||||
|
CloseHandle(original_file);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = GetSecurityInfo(original_file, SE_FILE_OBJECT, GROUP_SECURITY_INFORMATION, &sidOwner, &sidGroup, &dacl, &sacl, &sidGroupDescriptor);
|
||||||
|
|
||||||
|
//close file handle regardless of result
|
||||||
|
CloseHandle(original_file);
|
||||||
|
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
LocalFree(sidOwnerDescriptor);
|
||||||
|
LocalFree(sidGroupDescriptor);
|
||||||
|
LocalFree(daclDescriptor);
|
||||||
|
CloseHandle(original_file);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
CloseHandle(original_file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = GetNamedSecurityInfoW(source, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, &sidOwner, &sidGroup, &dacl, &sacl, &daclDescriptor);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
LocalFree(daclDescriptor);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = GetNamedSecurityInfoW(source, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION, &sidOwner, &sidGroup, &dacl, &sacl, &sidOwnerDescriptor);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
LocalFree(sidOwnerDescriptor);
|
||||||
|
LocalFree(daclDescriptor);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = GetNamedSecurityInfoW(source, SE_FILE_OBJECT, GROUP_SECURITY_INFORMATION, &sidOwner, &sidGroup, &dacl, &sacl, &sidGroupDescriptor);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
LocalFree(sidOwnerDescriptor);
|
||||||
|
LocalFree(sidGroupDescriptor);
|
||||||
|
LocalFree(daclDescriptor);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SECURITY_INFORMATION info = DACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION;
|
||||||
|
HANDLE target_file = CreateFileFromAppW(target, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||||
|
if (target_file != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
result = SetSecurityInfo(target_file, SE_FILE_OBJECT, info, sidOwner, sidGroup, dacl, sacl);
|
||||||
|
CloseHandle(target_file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wchar_t* temp = wcsdup(target);
|
||||||
|
result = SetNamedSecurityInfoW(temp, SE_FILE_OBJECT, info, sidOwner, sidGroup, dacl, sacl);
|
||||||
|
free(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
LocalFree(sidOwnerDescriptor);
|
||||||
|
LocalFree(sidGroupDescriptor);
|
||||||
|
LocalFree(daclDescriptor);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sidOwnerDescriptor != nullptr && LocalFree(sidOwnerDescriptor) != nullptr) || (daclDescriptor != nullptr && LocalFree(daclDescriptor) != nullptr) || (daclDescriptor != nullptr && LocalFree(daclDescriptor) != nullptr))
|
||||||
|
{
|
||||||
|
//an error occured but idk what error code is right so we just return -1
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//woo we made it all the way to the end so we can return success
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int uwp_mkdir_impl(std::experimental::filesystem::path dir)
|
||||||
|
{
|
||||||
|
//I feel like this should create the directory recursively but the existing implementation does not so this update won't
|
||||||
|
WIN32_FILE_ATTRIBUTE_DATA lpFileInfo;
|
||||||
|
bool parent_dir_exists = false;
|
||||||
|
|
||||||
|
if (dir.empty())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
//check if file attributes can be gotten successfully
|
||||||
|
if (GetFileAttributesExFromAppW(dir.parent_path().wstring().c_str(), GetFileExInfoStandard, &lpFileInfo))
|
||||||
|
{
|
||||||
|
//check that the files attributes are not null or empty
|
||||||
|
if (lpFileInfo.dwFileAttributes != INVALID_FILE_ATTRIBUTES && lpFileInfo.dwFileAttributes != 0)
|
||||||
|
{
|
||||||
|
if (lpFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
|
{
|
||||||
|
parent_dir_exists = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!parent_dir_exists)
|
||||||
|
{
|
||||||
|
//try to create parent dir
|
||||||
|
int success = uwp_mkdir_impl(dir.parent_path());
|
||||||
|
if (success != 0 || success != -2)
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Try Win32 first, this should work in AppData */
|
||||||
|
bool create_dir = CreateDirectoryFromAppW(dir.wstring().c_str(), NULL);
|
||||||
|
|
||||||
|
if (create_dir)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||||
|
return -2;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int retro_vfs_mkdir_impl(const char* dir)
|
||||||
|
{
|
||||||
|
return uwp_mkdir_impl(std::filesystem::path(dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
//the first run paramater is used to avoid error checking when doing recursion
|
||||||
|
//unlike the initial implementation this can move folders even empty ones when you want to move a directory structure
|
||||||
|
//this will fail even if a single file cannot be moved
|
||||||
|
int uwp_move_path(std::filesystem::path old_path, std::filesystem::path new_path, bool firstrun = true)
|
||||||
|
{
|
||||||
|
if (old_path.empty() || new_path.empty())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (firstrun)
|
||||||
|
{
|
||||||
|
WIN32_FILE_ATTRIBUTE_DATA lpFileInfo, targetfileinfo;
|
||||||
|
bool parent_dir_exists = false;
|
||||||
|
|
||||||
|
|
||||||
|
//make sure that parent path exists
|
||||||
|
if (GetFileAttributesExFromAppW(new_path.parent_path().wstring().c_str(), GetFileExInfoStandard, &lpFileInfo))
|
||||||
|
{
|
||||||
|
//check that the files attributes are not null or empty
|
||||||
|
if (lpFileInfo.dwFileAttributes != INVALID_FILE_ATTRIBUTES && lpFileInfo.dwFileAttributes != 0)
|
||||||
|
{
|
||||||
|
if (!(lpFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
|
{
|
||||||
|
//parent path doesn't exist ;-; so we gotta create it
|
||||||
|
uwp_mkdir_impl(new_path.parent_path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//make sure that source path exists
|
||||||
|
if (GetFileAttributesExFromAppW(old_path.wstring().c_str(), GetFileExInfoStandard, &lpFileInfo))
|
||||||
|
{
|
||||||
|
//check that the files attributes are not null or empty
|
||||||
|
if (lpFileInfo.dwFileAttributes != INVALID_FILE_ATTRIBUTES && lpFileInfo.dwFileAttributes != 0)
|
||||||
|
{
|
||||||
|
//check if source path is a dir
|
||||||
|
if (lpFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
|
{
|
||||||
|
//create the target dir
|
||||||
|
CreateDirectoryFromAppW(new_path.wstring().c_str(), NULL);
|
||||||
|
//call move function again but with first run disabled in order to move the folder
|
||||||
|
int result = uwp_move_path(old_path, new_path, false);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
//return the error
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//the file that we want to move exists so we can copy it now
|
||||||
|
//check if target file already exists
|
||||||
|
if (GetFileAttributesExFromAppW(new_path.wstring().c_str(), GetFileExInfoStandard, &targetfileinfo))
|
||||||
|
{
|
||||||
|
if (targetfileinfo.dwFileAttributes != INVALID_FILE_ATTRIBUTES && targetfileinfo.dwFileAttributes != 0 && (!(targetfileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)))
|
||||||
|
{
|
||||||
|
//delete target file
|
||||||
|
if (DeleteFileFromAppW(new_path.wstring().c_str()))
|
||||||
|
{
|
||||||
|
//return an error if we can't successfully delete the target file
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//move the file
|
||||||
|
if (!MoveFileFromAppW(old_path.wstring().c_str(), new_path.wstring().c_str()))
|
||||||
|
{
|
||||||
|
//failed to move the file
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
//set acl - this step fucking sucks or at least to before I made a whole ass function
|
||||||
|
//idk if we actually "need" to set the acl though
|
||||||
|
if (uwp_copy_acl(new_path.parent_path().wstring().c_str(), new_path.wstring().c_str()) != 0)
|
||||||
|
{
|
||||||
|
//setting acl failed
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//we are bypassing error checking and moving a dir
|
||||||
|
//first we gotta get a list of files in the dir
|
||||||
|
wchar_t* filteredPath = wcsdup(old_path.wstring().c_str());
|
||||||
|
wcscat_s(filteredPath, sizeof(L"\\*.*"), L"\\*.*");
|
||||||
|
WIN32_FIND_DATA findDataResult;
|
||||||
|
HANDLE searchResults = FindFirstFileExFromAppW(filteredPath, FindExInfoBasic, &findDataResult, FindExSearchNameMatch, nullptr, FIND_FIRST_EX_LARGE_FETCH);
|
||||||
|
if (searchResults != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
bool fail = false;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (findDataResult.cFileName != L"." && findDataResult.cFileName != L"..")
|
||||||
|
{
|
||||||
|
std::filesystem::path temp_old = old_path;
|
||||||
|
std::filesystem::path temp_new = new_path;
|
||||||
|
temp_old /= findDataResult.cFileName;
|
||||||
|
temp_new /= findDataResult.cFileName;
|
||||||
|
if (findDataResult.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
|
{
|
||||||
|
CreateDirectoryFromAppW(temp_new.wstring().c_str(), NULL);
|
||||||
|
int result = uwp_move_path(temp_old, temp_new, false);
|
||||||
|
if (result != 0)
|
||||||
|
fail = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WIN32_FILE_ATTRIBUTE_DATA targetfileinfo;
|
||||||
|
//the file that we want to move exists so we can copy it now
|
||||||
|
//check if target file already exists
|
||||||
|
if (GetFileAttributesExFromAppW(temp_new.wstring().c_str(), GetFileExInfoStandard, &targetfileinfo))
|
||||||
|
{
|
||||||
|
if (targetfileinfo.dwFileAttributes != INVALID_FILE_ATTRIBUTES && targetfileinfo.dwFileAttributes != 0 && (!(targetfileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)))
|
||||||
|
{
|
||||||
|
//delete target file
|
||||||
|
if (DeleteFileFromAppW(temp_new.wstring().c_str()))
|
||||||
|
{
|
||||||
|
//return an error if we can't successfully delete the target file
|
||||||
|
fail = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//move the file
|
||||||
|
if (!MoveFileFromAppW(temp_old.wstring().c_str(), temp_new.wstring().c_str()))
|
||||||
|
{
|
||||||
|
//failed to move the file
|
||||||
|
fail = true;
|
||||||
|
}
|
||||||
|
//set acl - this step fucking sucks or at least to before I made a whole ass function
|
||||||
|
//idk if we actually "need" to set the acl though
|
||||||
|
if (uwp_copy_acl(new_path.wstring().c_str(), temp_new.wstring().c_str()) != 0)
|
||||||
|
{
|
||||||
|
//setting acl failed
|
||||||
|
fail = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (FindNextFile(searchResults, &findDataResult));
|
||||||
|
FindClose(searchResults);
|
||||||
|
if (fail)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
free(filteredPath);
|
||||||
|
}
|
||||||
|
//yooooooo we finally made it all the way to the end
|
||||||
|
//we can now return success
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//c doesn't support default arguments so we wrap it up in a shell to enable us to use default arguments
|
||||||
|
//default arguments mean that we can do better recursion
|
||||||
|
int retro_vfs_file_rename_impl(const char* old_path, const char* new_path)
|
||||||
|
{
|
||||||
|
return uwp_move_path(std::filesystem::path(old_path), std::filesystem::path(old_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *stream)
|
const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *stream)
|
||||||
@ -825,9 +1129,6 @@ const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *strea
|
|||||||
int retro_vfs_stat_impl(const char *path, int32_t *size)
|
int retro_vfs_stat_impl(const char *path, int32_t *size)
|
||||||
{
|
{
|
||||||
wchar_t *path_wide;
|
wchar_t *path_wide;
|
||||||
Platform::String^ path_str;
|
|
||||||
IStorageItem^ item;
|
|
||||||
DWORD file_info;
|
|
||||||
_WIN32_FILE_ATTRIBUTE_DATA attribdata;
|
_WIN32_FILE_ATTRIBUTE_DATA attribdata;
|
||||||
|
|
||||||
if (!path || !*path)
|
if (!path || !*path)
|
||||||
@ -835,16 +1136,13 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
|
|||||||
|
|
||||||
path_wide = utf8_to_utf16_string_alloc(path);
|
path_wide = utf8_to_utf16_string_alloc(path);
|
||||||
windowsize_path(path_wide);
|
windowsize_path(path_wide);
|
||||||
path_str = ref new Platform::String(path_wide);
|
|
||||||
free(path_wide);
|
|
||||||
|
|
||||||
/* Try Win32 first, this should work in AppData */
|
/* Try Win32 first, this should work in AppData */
|
||||||
if (GetFileAttributesExFromAppW(path_str->Data(), GetFileExInfoStandard, &attribdata))
|
if (GetFileAttributesExFromAppW(path_wide, GetFileExInfoStandard, &attribdata))
|
||||||
{
|
{
|
||||||
file_info = attribdata.dwFileAttributes;
|
if (attribdata.dwFileAttributes != INVALID_FILE_ATTRIBUTES)
|
||||||
if (file_info != INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
{
|
||||||
if (!(file_info & FILE_ATTRIBUTE_DIRECTORY))
|
if (!(attribdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
{
|
{
|
||||||
LARGE_INTEGER sz;
|
LARGE_INTEGER sz;
|
||||||
if (size)
|
if (size)
|
||||||
@ -854,100 +1152,14 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
|
|||||||
*size = sz.QuadPart;
|
*size = sz.QuadPart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (file_info & FILE_ATTRIBUTE_DIRECTORY) ? RETRO_VFS_STAT_IS_VALID | RETRO_VFS_STAT_IS_DIRECTORY : RETRO_VFS_STAT_IS_VALID;
|
return (attribdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? RETRO_VFS_STAT_IS_VALID | RETRO_VFS_STAT_IS_DIRECTORY : RETRO_VFS_STAT_IS_VALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
if (GetLastError() == ERROR_FILE_NOT_FOUND)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Fallback to WinRT */
|
|
||||||
item = LocateStorageFileOrFolder(path_str);
|
|
||||||
if (!item)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return RunAsyncAndCatchErrors<int>([&]() {
|
|
||||||
return concurrency::create_task(item->GetBasicPropertiesAsync()).then([&](BasicProperties^ properties) {
|
|
||||||
if (size)
|
|
||||||
*size = properties->Size;
|
|
||||||
return item->IsOfType(StorageItemTypes::Folder) ? RETRO_VFS_STAT_IS_VALID | RETRO_VFS_STAT_IS_DIRECTORY : RETRO_VFS_STAT_IS_VALID;
|
|
||||||
});
|
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int retro_vfs_mkdir_impl(const char *dir)
|
|
||||||
{
|
|
||||||
Platform::String^ parent_path_str;
|
|
||||||
Platform::String^ dir_name_str;
|
|
||||||
Platform::String^ dir_str;
|
|
||||||
wchar_t *dir_name_wide, *parent_path_wide, *dir_wide;
|
|
||||||
char *dir_local, *tmp;
|
|
||||||
char parent_path[PATH_MAX_LENGTH];
|
|
||||||
char dir_name[PATH_MAX_LENGTH];
|
|
||||||
BOOL result;
|
|
||||||
|
|
||||||
if (!dir || !*dir)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
dir_name[0] = '\0';
|
|
||||||
|
|
||||||
/* If the path ends with a slash, we have to remove
|
|
||||||
* it for basename to work */
|
|
||||||
dir_local = strdup(dir);
|
|
||||||
tmp = dir_local + strlen(dir_local) - 1;
|
|
||||||
|
|
||||||
if (PATH_CHAR_IS_SLASH(*tmp))
|
|
||||||
*tmp = 0;
|
|
||||||
|
|
||||||
dir_wide = utf8_to_utf16_string_alloc(dir_local);
|
|
||||||
windowsize_path(dir_wide);
|
|
||||||
dir_str = ref new Platform::String(dir_wide);
|
|
||||||
free(dir_wide);
|
|
||||||
|
|
||||||
fill_pathname_base(dir_name, dir_local, sizeof(dir_name));
|
|
||||||
dir_name_wide = utf8_to_utf16_string_alloc(dir_name);
|
|
||||||
dir_name_str = ref new Platform::String(dir_name_wide);
|
|
||||||
free(dir_name_wide);
|
|
||||||
|
|
||||||
fill_pathname_parent_dir(parent_path, dir_local, sizeof(parent_path));
|
|
||||||
parent_path_wide = utf8_to_utf16_string_alloc(parent_path);
|
|
||||||
windowsize_path(parent_path_wide);
|
|
||||||
parent_path_str = ref new Platform::String(parent_path_wide);
|
|
||||||
free(parent_path_wide);
|
|
||||||
|
|
||||||
retro_assert(!dir_name_str->IsEmpty()
|
|
||||||
&& !parent_path_str->IsEmpty());
|
|
||||||
|
|
||||||
free(dir_local);
|
|
||||||
|
|
||||||
/* Try Win32 first, this should work in AppData */
|
|
||||||
result = CreateDirectoryFromAppW(dir_str->Data(), NULL);
|
|
||||||
if (result)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
|
||||||
return -2;
|
|
||||||
|
|
||||||
/* Fallback to WinRT */
|
|
||||||
return RunAsyncAndCatchErrors<int>([&]() {
|
|
||||||
return concurrency::create_task(LocateStorageItem<StorageFolder>(
|
|
||||||
parent_path_str)).then([&](StorageFolder^ parent) {
|
|
||||||
return parent->CreateFolderAsync(dir_name_str);
|
|
||||||
}).then([&](concurrency::task<StorageFolder^> new_dir) {
|
|
||||||
try
|
|
||||||
{
|
|
||||||
new_dir.get();
|
|
||||||
}
|
|
||||||
catch (Platform::COMException^ e)
|
|
||||||
{
|
|
||||||
if (e->HResult == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS))
|
|
||||||
return -2;
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
}, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VFS_FRONTEND
|
#ifdef VFS_FRONTEND
|
||||||
struct retro_vfs_dir_handle
|
struct retro_vfs_dir_handle
|
||||||
@ -1030,24 +1242,6 @@ int retro_vfs_closedir_impl(libretro_vfs_implementation_dir *rdir)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool uwp_drive_exists(const char *path)
|
|
||||||
{
|
|
||||||
wchar_t *path_wide;
|
|
||||||
Platform::String^ path_str;
|
|
||||||
if (!path || !*path)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
path_wide = utf8_to_utf16_string_alloc(path);
|
|
||||||
path_str = ref new Platform::String(path_wide);
|
|
||||||
free(path_wide);
|
|
||||||
|
|
||||||
return RunAsyncAndCatchErrors<bool>([&]() {
|
|
||||||
return concurrency::create_task(StorageFolder::GetFolderFromPathAsync(path_str)).then([](StorageFolder^ properties) {
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* uwp_trigger_picker(void)
|
char* uwp_trigger_picker(void)
|
||||||
{
|
{
|
||||||
return RunAsyncAndCatchErrors<char*>([&]() {
|
return RunAsyncAndCatchErrors<char*>([&]() {
|
||||||
|
@ -522,18 +522,22 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\libretro-common\vfs\vfs_implementation_uwp.cpp">
|
<ClCompile Include="..\..\..\libretro-common\vfs\vfs_implementation_uwp.cpp">
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|x64'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|x64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|x64'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|x64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|ARM'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|ARM'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|ARM'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|ARM'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|Win32'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|Win32'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|Win32'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|Win32'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_BUILTINGLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_ONLINE_UPDATER;HAVE_UPDATE_ASSETS;HAVE_UPDATE_CORES;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_TRANSLATE;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_OZONE;HAVE_SHADERPIPELINE;DEBUG;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_GFX_WIDGETS;HAVE_CONFIGFILE;HAVE_PATCH;HAVE_DSP_FILTER;HAVE_VIDEO_FILTER;HAVE_REWIND;HAVE_SCREENSHOTS;HAVE_CHEATS;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_AUDIOMIXER;HAVE_RWAV;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS</PreprocessorDefinitions>
|
||||||
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|ARM64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_BUILTINGLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_ONLINE_UPDATER;HAVE_UPDATE_ASSETS;HAVE_UPDATE_CORES;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_TRANSLATE;HAVE_XMB;HAVE_OZONE;HAVE_SHADERPIPELINE;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_MENU;HAVE_GFX_WIDGETS;HAVE_CONFIGFILE;HAVE_PATCH;HAVE_DSP_FILTER;HAVE_VIDEO_FILTER;HAVE_REWIND;HAVE_SCREENSHOTS;HAVE_CHEATS;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_AUDIOMIXER;HAVE_RWAV;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS;HAVE_ANGLE;HAVE_OPENGL;HAVE_OPENGLES;HAVE_OPENGLES2;HAVE_GLSL</PreprocessorDefinitions>
|
||||||
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|ARM64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_BUILTINGLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_ONLINE_UPDATER;HAVE_UPDATE_ASSETS;HAVE_UPDATE_CORES;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_TRANSLATE;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_OZONE;HAVE_SHADERPIPELINE;DEBUG;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_GFX_WIDGETS;HAVE_CONFIGFILE;HAVE_PATCH;HAVE_DSP_FILTER;HAVE_VIDEO_FILTER;HAVE_REWIND;HAVE_SCREENSHOTS;HAVE_CHEATS;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_AUDIOMIXER;HAVE_RWAV;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS;HAVE_ANGLE;HAVE_OPENGL;HAVE_OPENGLES;HAVE_OPENGLES2;HAVE_GLSL</PreprocessorDefinitions>
|
||||||
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_BUILTINGLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_ONLINE_UPDATER;HAVE_UPDATE_ASSETS;HAVE_UPDATE_CORES;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_TRANSLATE;HAVE_XMB;HAVE_OZONE;HAVE_SHADERPIPELINE;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_MENU;HAVE_GFX_WIDGETS;HAVE_CONFIGFILE;HAVE_PATCH;HAVE_DSP_FILTER;HAVE_VIDEO_FILTER;HAVE_REWIND;HAVE_SCREENSHOTS;HAVE_CHEATS;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_AUDIOMIXER;HAVE_RWAV;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -636,4 +640,4 @@
|
|||||||
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets" />
|
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets" />
|
||||||
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.targets" />
|
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.targets" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
@ -515,18 +515,22 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\libretro-common\vfs\vfs_implementation_uwp.cpp">
|
<ClCompile Include="..\..\..\libretro-common\vfs\vfs_implementation_uwp.cpp">
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">VFS_FRONTEND;_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|x64'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|x64'">VFS_FRONTEND;_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">VFS_FRONTEND;_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|x64'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|x64'">VFS_FRONTEND;_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|ARM'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|ARM'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|ARM'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|ARM'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|Win32'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|Win32'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|Win32'">VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|Win32'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;VFS_FRONTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_BUILTINGLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_ONLINE_UPDATER;HAVE_UPDATE_ASSETS;HAVE_UPDATE_CORES;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_TRANSLATE;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_OZONE;HAVE_SHADERPIPELINE;DEBUG;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_GFX_WIDGETS;HAVE_CONFIGFILE;HAVE_PATCH;HAVE_DSP_FILTER;HAVE_VIDEO_FILTER;HAVE_REWIND;HAVE_SCREENSHOTS;HAVE_CHEATS;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_AUDIOMIXER;HAVE_RWAV;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS</PreprocessorDefinitions>
|
||||||
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ReleaseANGLE|ARM64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_BUILTINGLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_ONLINE_UPDATER;HAVE_UPDATE_ASSETS;HAVE_UPDATE_CORES;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_TRANSLATE;HAVE_XMB;HAVE_OZONE;HAVE_SHADERPIPELINE;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_MENU;HAVE_GFX_WIDGETS;HAVE_CONFIGFILE;HAVE_PATCH;HAVE_DSP_FILTER;HAVE_VIDEO_FILTER;HAVE_REWIND;HAVE_SCREENSHOTS;HAVE_CHEATS;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_AUDIOMIXER;HAVE_RWAV;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS;HAVE_ANGLE;HAVE_OPENGL;HAVE_OPENGLES;HAVE_OPENGLES2;HAVE_GLSL</PreprocessorDefinitions>
|
||||||
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugANGLE|ARM64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_BUILTINGLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_ONLINE_UPDATER;HAVE_UPDATE_ASSETS;HAVE_UPDATE_CORES;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_TRANSLATE;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_OZONE;HAVE_SHADERPIPELINE;DEBUG;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_GFX_WIDGETS;HAVE_CONFIGFILE;HAVE_PATCH;HAVE_DSP_FILTER;HAVE_VIDEO_FILTER;HAVE_REWIND;HAVE_SCREENSHOTS;HAVE_CHEATS;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_AUDIOMIXER;HAVE_RWAV;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS;HAVE_ANGLE;HAVE_OPENGL;HAVE_OPENGLES;HAVE_OPENGLES2;HAVE_GLSL</PreprocessorDefinitions>
|
||||||
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING;WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_BUILTINGLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_ONLINE_UPDATER;HAVE_UPDATE_ASSETS;HAVE_UPDATE_CORES;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_TRANSLATE;HAVE_XMB;HAVE_OZONE;HAVE_SHADERPIPELINE;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_MENU;HAVE_GFX_WIDGETS;HAVE_CONFIGFILE;HAVE_PATCH;HAVE_DSP_FILTER;HAVE_VIDEO_FILTER;HAVE_REWIND;HAVE_SCREENSHOTS;HAVE_CHEATS;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_AUDIOMIXER;HAVE_RWAV;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
66
uwp/std_filesystem_compat.h
Normal file
66
uwp/std_filesystem_compat.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
//this file checks in order to ensure that right version of std::filesystem is returned for the version of c++
|
||||||
|
|
||||||
|
// We haven't checked which filesystem to include yet
|
||||||
|
#ifndef INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
|
||||||
|
// Check for feature test macro for <filesystem>
|
||||||
|
# if defined(__cpp_lib_filesystem)
|
||||||
|
# define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 0
|
||||||
|
|
||||||
|
// Check for feature test macro for <experimental/filesystem>
|
||||||
|
# elif defined(__cpp_lib_experimental_filesystem)
|
||||||
|
# define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
|
||||||
|
|
||||||
|
// We can't check if headers exist...
|
||||||
|
// Let's assume experimental to be safe
|
||||||
|
# elif !defined(__has_include)
|
||||||
|
# define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
|
||||||
|
|
||||||
|
// Check if the header "<filesystem>" exists
|
||||||
|
# elif __has_include(<filesystem>)
|
||||||
|
|
||||||
|
// If we're compiling on Visual Studio and are not compiling with C++17, we need to use experimental
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
|
||||||
|
// Check and include header that defines "_HAS_CXX17"
|
||||||
|
# if __has_include(<yvals_core.h>)
|
||||||
|
# include <yvals_core.h>
|
||||||
|
|
||||||
|
// Check for enabled C++17 support
|
||||||
|
# if defined(_HAS_CXX17) && _HAS_CXX17
|
||||||
|
// We're using C++17, so let's use the normal version
|
||||||
|
# define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 0
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
// If the marco isn't defined yet, that means any of the other VS specific checks failed, so we need to use experimental
|
||||||
|
# ifndef INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
# define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
// Not on Visual Studio. Let's use the normal version
|
||||||
|
# else // #ifdef _MSC_VER
|
||||||
|
# define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
// Check if the header "<filesystem>" exists
|
||||||
|
# elif __has_include(<experimental/filesystem>)
|
||||||
|
# define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
|
||||||
|
|
||||||
|
// Fail if neither header is available with a nice error message
|
||||||
|
# else
|
||||||
|
# error Could not find system header "<filesystem>" or "<experimental/filesystem>"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
// We priously determined that we need the exprimental version
|
||||||
|
# if INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
// Include it
|
||||||
|
# include <experimental/filesystem>
|
||||||
|
// We need the alias from std::experimental::filesystem to std::filesystem
|
||||||
|
namespace std {
|
||||||
|
namespace filesystem = experimental::filesystem;
|
||||||
|
}
|
||||||
|
# else // We have a decent compiler and can use the normal version
|
||||||
|
# include <filesystem>// Include it
|
||||||
|
# endif
|
||||||
|
#endif // #ifndef INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
|
Loading…
x
Reference in New Issue
Block a user