From d0e48f2efb9ca06a080b38888706bc4fc75fce3b Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Tue, 4 Apr 2017 14:00:51 -0700 Subject: [PATCH] add paths_win.cc to FML (#3563) * add paths_win.cc to FML * update licenses --- fml/BUILD.gn | 1 + fml/platform/win/paths_win.cc | 28 +++++++++++++++++++++++++ travis/licenses_golden/licenses_flutter | 1 + 3 files changed, 30 insertions(+) create mode 100644 fml/platform/win/paths_win.cc diff --git a/fml/BUILD.gn b/fml/BUILD.gn index 6d66faaa8..12a5f41a0 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 000000000..ef87a9677 --- /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 fc8451dba..c8cd611d1 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 -- GitLab