Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 847a018f authored by Erwin Jansen's avatar Erwin Jansen
Browse files

Treat file paths as UTF-8

Chrome has a class to make it easier to work with file paths in a cross
platform fashion.

Unfortunately this class exposes different base types under windows (std::wstring vs
std::string).

We now assume that all file paths are utf-8 encoded (true for posix), so
we can use std::string for both Win32 and posix.

Bug: 186567864
Change-Id: Idb1389ce19502599a7fd4fd60a62c99b9a318e93
Test: Launch rootcanal, see gDevice beacon show up
parent 11598dec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ DeviceProperties::DeviceProperties(const std::string& file_name)
    return;
  }
  LOG_INFO("Reading controller properties from %s.", file_name.c_str());
  if (!base::ReadFileToString(base::FilePath(file_name), &properties_raw)) {
  if (!base::ReadFileToString(base::FilePath::FromUTF8Unsafe(file_name), &properties_raw)) {
    LOG_ERROR("Error reading controller properties from file.");
    return;
  }
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ void TestCommandHandler::FromFile(const std::string& file_name) {
  }

  std::string commands_raw;
  if (!base::ReadFileToString(base::FilePath(file_name), &commands_raw)) {
  if (!base::ReadFileToString(base::FilePath::FromUTF8Unsafe(file_name), &commands_raw)) {
    LOG_ERROR("Error reading commands from file.");
    return;
  }