50 DWORD fileattr = GetFileAttributesA(path.c_str());
51 if (fileattr != INVALID_FILE_ATTRIBUTES)
52 return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0;
55 stat_wrapper_t file_info;
56 if (CallStat(path.c_str(), &file_info) != 0)
58 return S_ISDIR(file_info.st_mode);
71 char path_buffer[MAX_PATH];
74 if (GetModuleFileNameA(NULL, path_buffer, MAX_PATH) == 0)
76 *path = std::string(path_buffer);
77#elif defined(__APPLE__)
79 unsigned int path_length = 0;
80 _NSGetExecutablePath(NULL, &path_length);
84 path->reserve(path_length);
85 path->resize(path_length - 1);
86 if (_NSGetExecutablePath(&((*path)[0]), &path_length))
89 static const char kProcSelfExe[] =
"/proc/self/exe";
91 ssize_t count = ::readlink(kProcSelfExe, buf,
PATH_MAX);
95 *path = std::string(buf, count);
99 size_t pos = path->size() - 1;
100 if (EndsWithSeparator(*path))
103 if (found == std::string::npos)
128 if (!GetSourceDir(path))
131 if (!EndsWithSeparator(*path))
134 std::string potential_path = *path;
135 potential_path.append(
"testing");
137 potential_path.append(
"resources");
138 if (
PathService::DirectoryExists(potential_path)) {
139 *path = potential_path;
143 potential_path = *path;
144 potential_path.append(
"third_party");
146 potential_path.append(
"pdfium");
148 potential_path.append(
"testing");
150 potential_path.append(
"resources");
151 if (
PathService::DirectoryExists(potential_path)) {
152 *path = potential_path;
176 if (!GetSourceDir(path))
179 if (!EndsWithSeparator(*path))
182 std::string potential_path = *path;
183 potential_path.append(
"third_party");
188 *path = potential_path;
193 potential_path = *path;
194 potential_path.append(
"third_party");
196 potential_path.append(
"pdfium");
198 potential_path.append(
"third_party");
200 if (
PathService::DirectoryExists(potential_path)) {
201 *path = potential_path;