xref: /aosp_15_r20/external/skia/src/utils/SkGetExecutablePath_win.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 "src/utils/SkGetExecutablePath.h"
9 
10 #include <windows.h>
11 
SkGetExecutablePath()12 std::string SkGetExecutablePath() {
13     char executableFileBuf[MAX_PATH];
14     DWORD executablePathLen = GetModuleFileNameA(nullptr, executableFileBuf, MAX_PATH);
15     return (executablePathLen > 0) ? std::string(executableFileBuf) : std::string();
16 }
17