1 /* 2 * Copyright 2022 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "tools/SkGetExecutablePath.h" 9 #include <mach-o/dyld.h> 10 SkGetExecutablePath()11std::string SkGetExecutablePath() { 12 uint32_t size = 0; 13 _NSGetExecutablePath(nullptr, &size); 14 15 std::string result(size, '\0'); 16 if (_NSGetExecutablePath(result.data(), &size) != 0) { 17 result.clear(); 18 } 19 return result; 20 } 21