static
| 23 | |
| 24 | // static |
| 25 | bool Paths::Executable(base::FilePath* path) { |
| 26 | uint32_t executable_length = 0; |
| 27 | _NSGetExecutablePath(nullptr, &executable_length); |
| 28 | if (executable_length <= 1) { |
| 29 | LOG(ERROR) << "_NSGetExecutablePath"; |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | std::string executable_path(executable_length - 1, std::string::value_type()); |
| 34 | int rv = _NSGetExecutablePath(&executable_path[0], &executable_length); |
| 35 | if (rv != 0) { |
| 36 | LOG(ERROR) << "_NSGetExecutablePath"; |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | *path = base::FilePath(executable_path); |
| 41 | return true; |
| 42 | } |
| 43 | |
| 44 | } // namespace crashpad |