Skip to content

Commit

Permalink
add paths_win.cc to FML (flutter#3563)
Browse files Browse the repository at this point in the history
* add paths_win.cc to FML

* update licenses
  • Loading branch information
goderbauer authored Apr 4, 2017
1 parent 772a0db commit d0e48f2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions fml/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
}
}
Expand Down
28 changes: 28 additions & 0 deletions fml/platform/win/paths_win.cc
Original file line number Diff line number Diff line change
@@ -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 <windows.h>

#include "lib/ftl/files/path.h"

namespace fml {
namespace paths {

std::pair<bool, std::string> 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
1 change: 1 addition & 0 deletions travis/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d0e48f2

Please sign in to comment.