fix _access is os specify

main-headless
ink-soul 2024-04-17 13:54:29 +08:00
parent c609c5a354
commit 6fc72ce66e
2 changed files with 4 additions and 3 deletions

View File

@ -10,17 +10,17 @@ const std::string getAssetPath()
return ""; return "";
#elif defined(VK_EXAMPLE_DATA_DIR) #elif defined(VK_EXAMPLE_DATA_DIR)
if (_access("./../data/", 0) != -1) if (std::filesystem::exists("./../data/"))
{ {
return "./../data/"; return "./../data/";
} }
else if (_access("./data/", 0) != -1) else if (std::filesystem::exists("./data/"))
{ {
return "./data/"; return "./data/";
} }
else if (_access("./../../data/", 0) != -1) else if (std::filesystem::exists("./../../data/"))
{ {
return "../../data/"; return "../../data/";

View File

@ -16,6 +16,7 @@
#include <stdexcept> #include <stdexcept>
#include <fstream> #include <fstream>
#include <algorithm> #include <algorithm>
#include <filesystem>
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> #include <windows.h>
#include <fcntl.h> #include <fcntl.h>