Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1dbf3ff

Browse files
Convert the executable directory path to UTF-8 on Windows (#36908)
1 parent 04fa86e commit 1dbf3ff

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fml/platform/win/paths_win.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <algorithm>
1010

1111
#include "flutter/fml/paths.h"
12+
#include "flutter/fml/platform/win/wstring_conversion.h"
1213

1314
namespace fml {
1415
namespace paths {
@@ -58,12 +59,12 @@ std::pair<bool, std::string> GetExecutablePath() {
5859
if (module == NULL) {
5960
return {false, ""};
6061
}
61-
char path[MAX_PATH];
62-
DWORD read_size = GetModuleFileNameA(module, path, MAX_PATH);
62+
wchar_t path[MAX_PATH];
63+
DWORD read_size = GetModuleFileNameW(module, path, MAX_PATH);
6364
if (read_size == 0 || read_size == MAX_PATH) {
6465
return {false, ""};
6566
}
66-
return {true, std::string{path, read_size}};
67+
return {true, WideStringToUtf8({path, read_size})};
6768
}
6869

6970
std::string AbsolutePath(const std::string& path) {

0 commit comments

Comments
 (0)