diff --git a/fml/BUILD.gn b/fml/BUILD.gn index 6d66faaa803c6a3ce768655ae18d5631c34244c9..12a5f41a0f89dac914b181e76cd07a904e6240d4 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -95,6 +95,7 @@ source_set("fml") { sources += [ "platform/win/message_loop_win.cc", "platform/win/message_loop_win.h", + "platform/win/paths_win.cc", ] } } diff --git a/fml/platform/win/paths_win.cc b/fml/platform/win/paths_win.cc new file mode 100644 index 0000000000000000000000000000000000000000..ef87a967719b3e5bc217bab232d3f85e73f8ce8b --- /dev/null +++ b/fml/platform/win/paths_win.cc @@ -0,0 +1,28 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/fml/paths.h" + +#include + +#include "lib/ftl/files/path.h" + +namespace fml { +namespace paths { + +std::pair GetExecutableDirectoryPath() { + HMODULE module = GetModuleHandle(NULL); + if (module == NULL) { + return {false, ""}; + } + char path[MAX_PATH]; + DWORD read_size = GetModuleFileNameA(module, path, MAX_PATH); + if (read_size == 0 || read_size == MAX_PATH) { + return {false, ""}; + } + return {true, files::GetDirectoryName(std::string{path, read_size})}; +} + +} // namespace paths +} // namespace fml diff --git a/travis/licenses_golden/licenses_flutter b/travis/licenses_golden/licenses_flutter index fc8451dbaf436b3328587bf0ce8b73686c89338d..c8cd611d186c9712c603f4728550d39e7e57c439 100644 --- a/travis/licenses_golden/licenses_flutter +++ b/travis/licenses_golden/licenses_flutter @@ -1401,6 +1401,7 @@ FILE: ../../../flutter/fml/platform/linux/timerfd.cc FILE: ../../../flutter/fml/platform/linux/timerfd.h FILE: ../../../flutter/fml/platform/win/message_loop_win.cc FILE: ../../../flutter/fml/platform/win/message_loop_win.h +FILE: ../../../flutter/fml/platform/win/paths_win.cc FILE: ../../../flutter/fml/task_observer.h FILE: ../../../flutter/fml/task_runner.cc FILE: ../../../flutter/fml/task_runner.h