46 DWORD fileattr = GetFileAttributesA(path.c_str());
47 if (fileattr != INVALID_FILE_ATTRIBUTES)
48 return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0;
51 stat_wrapper_t file_info;
52 if (CallStat(path.c_str(), &file_info) != 0)
54 return S_ISDIR(file_info.st_mode);
67 char path_buffer[MAX_PATH];
70 if (GetModuleFileNameA(NULL, path_buffer, MAX_PATH) == 0)
72 *path = std::string(path_buffer);
73#elif defined(__APPLE__)
75 unsigned int path_length = 0;
76 _NSGetExecutablePath(NULL, &path_length);
80 path->reserve(path_length);
81 path->resize(path_length - 1);
82 if (_NSGetExecutablePath(&((*path)[0]), &path_length))
85 static const char kProcSelfExe[] =
"/proc/self/exe";
87 ssize_t count = ::readlink(kProcSelfExe, buf,
PATH_MAX);
91 *path = std::string(buf, count);
95 size_t pos = path->size() - 1;
96 if (EndsWithSeparator(*path))
99 if (found == std::string::npos)
124 if (!GetSourceDir(path))
127 if (!EndsWithSeparator(*path))
130 std::string potential_path = *path;
131 potential_path.append(
"testing");
133 potential_path.append(
"resources");
134 if (
PathService::DirectoryExists(potential_path)) {
135 *path = potential_path;
139 potential_path = *path;
140 potential_path.append(
"third_party");
142 potential_path.append(
"pdfium");
144 potential_path.append(
"testing");
146 potential_path.append(
"resources");
147 if (
PathService::DirectoryExists(potential_path)) {
148 *path = potential_path;
172 if (!GetSourceDir(path))
175 if (!EndsWithSeparator(*path))
178 std::string potential_path = *path;
179 potential_path.append(
"third_party");
184 *path = potential_path;
189 potential_path = *path;
190 potential_path.append(
"third_party");
192 potential_path.append(
"pdfium");
194 potential_path.append(
"third_party");
196 if (
PathService::DirectoryExists(potential_path)) {
197 *path = potential_path;