Skip to content

Commit

Permalink
Convert the executable directory path to UTF-8 on Windows (flutter#36908
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jason-simmons authored Oct 21, 2022
1 parent 04fa86e commit 1dbf3ff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fml/platform/win/paths_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>

#include "flutter/fml/paths.h"
#include "flutter/fml/platform/win/wstring_conversion.h"

namespace fml {
namespace paths {
Expand Down Expand Up @@ -58,12 +59,12 @@ std::pair<bool, std::string> GetExecutablePath() {
if (module == NULL) {
return {false, ""};
}
char path[MAX_PATH];
DWORD read_size = GetModuleFileNameA(module, path, MAX_PATH);
wchar_t path[MAX_PATH];
DWORD read_size = GetModuleFileNameW(module, path, MAX_PATH);
if (read_size == 0 || read_size == MAX_PATH) {
return {false, ""};
}
return {true, std::string{path, read_size}};
return {true, WideStringToUtf8({path, read_size})};
}

std::string AbsolutePath(const std::string& path) {
Expand Down

0 comments on commit 1dbf3ff

Please sign in to comment.