Alternative check

This commit is contained in:
Vyacheslav Egorov 2024-04-02 21:31:02 +03:00
parent d1df773e47
commit 3e437e4957

View file

@ -89,9 +89,7 @@ public:
std::string luauDirRel = "."; std::string luauDirRel = ".";
std::string luauDirAbs; std::string luauDirAbs;
#if !__APPLE__ || !TARGET_OS_IPHONE #if TARGET_OS_IPHONE
std::optional<std::string> cwd = getCurrentWorkingDirectory();
#else
std::optional<std::string> cwd0 = getCurrentWorkingDirectory(); std::optional<std::string> cwd0 = getCurrentWorkingDirectory();
std::optional<std::string> cwd = getResourcePath(); std::optional<std::string> cwd = getResourcePath();
if (cwd && cwd0) if (cwd && cwd0)
@ -105,6 +103,8 @@ public:
luauDirRel = "./" + _res.substr(_cwd.length()); luauDirRel = "./" + _res.substr(_cwd.length());
} }
} }
#else
std::optional<std::string> cwd = getCurrentWorkingDirectory();
#endif #endif
REQUIRE_MESSAGE(cwd, "Error getting Luau path"); REQUIRE_MESSAGE(cwd, "Error getting Luau path");
std::replace((*cwd).begin(), (*cwd).end(), '\\', '/'); std::replace((*cwd).begin(), (*cwd).end(), '\\', '/');