#include "testing/utils/path_service.h"
#include <stddef.h>
#ifdef _WIN32
#include <Windows.h>
#elif defined(__APPLE__)
#include <mach-o/dyld.h>
#include <sys/stat.h>
#else
#include <linux/limits.h>
#include <sys/stat.h>
#include <unistd.h>
#endif
#include <string>
#include "core/fxcrt/check.h"
#include "core/fxcrt/fx_system.h"
namespace {
#if defined(__APPLE__) || (defined(ANDROID) && __ANDROID_API__ < 21)
using stat_wrapper_t = struct stat;
int CallStat(const char* path, stat_wrapper_t* sb) {
return stat(path, sb);
}
#elif !_WIN32
stat_wrapper_t;
int CallStat(const char* path, stat_wrapper_t* sb) { … }
#endif
}
bool PathService::DirectoryExists(const std::string& path) { … }
bool PathService::EndsWithSeparator(const std::string& path) { … }
bool PathService::GetExecutableDir(std::string* path) { … }
bool PathService::GetSourceDir(std::string* path) { … }
bool PathService::GetTestDataDir(std::string* path) { … }
std::string PathService::GetTestFilePath(const std::string& file_name) { … }
bool PathService::GetThirdPartyFilePath(const std::string& file_name,
std::string* path) { … }