add paths_win.cc to FML (flutter/engine#3563)
* add paths_win.cc to FML * update licenses
This commit is contained in:
committed by
GitHub
parent
1132f031d9
commit
4de155b1e3
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
28
engine/src/flutter/fml/platform/win/paths_win.cc
Normal file
28
engine/src/flutter/fml/platform/win/paths_win.cc
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user