John Stiles | 964d8f1 | 2022-10-26 13:52:03 -0400 | [diff] [blame] | 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 <windows.h> |
| 10 | |
John Stiles | f04b827 | 2022-11-04 13:58:26 -0400 | [diff] [blame] | 11 | std::string SkGetExecutablePath() { |
John Stiles | 964d8f1 | 2022-10-26 13:52:03 -0400 | [diff] [blame] | 12 | char executableFileBuf[MAX_PATH]; |
| 13 | DWORD executablePathLen = GetModuleFileNameA(nullptr, executableFileBuf, MAX_PATH); |
John Stiles | f04b827 | 2022-11-04 13:58:26 -0400 | [diff] [blame] | 14 | return (executablePathLen > 0) ? std::string(executableFileBuf) : std::string(); |
John Stiles | 964d8f1 | 2022-10-26 13:52:03 -0400 | [diff] [blame] | 15 | } |