diff --git a/src/node_errors.cc b/src/node_errors.cc index 609601328f7f5f..180346f775d245 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -548,7 +548,7 @@ static void ReportFatalException(Environment* env, FPrintF(stderr, "(Use `%s --trace-uncaught ...` to show where the exception " "was thrown)\n", - filesystem_path.filename().string()); + filesystem_path.filename().string().c_str()); } } diff --git a/src/node_modules.cc b/src/node_modules.cc index 4b522a91323c9f..8c5de164f8622b 100644 --- a/src/node_modules.cc +++ b/src/node_modules.cc @@ -340,12 +340,14 @@ void BindingData::GetNearestParentPackageJSON( ToNamespacedPath(realm->env(), &path_value); std::string path_value_str = path_value.ToString(); + auto path_value_u8str = + std::u8string(path_value_str.begin(), path_value_str.end()); if (slashCheck) { - path_value_str.push_back(kPathSeparator); + path_value_u8str.push_back(kPathSeparator); } auto package_json = - TraverseParent(realm, std::filesystem::path(path_value_str)); + TraverseParent(realm, std::filesystem::path(path_value_u8str)); if (package_json != nullptr) { args.GetReturnValue().Set(package_json->Serialize(realm)); @@ -366,12 +368,14 @@ void BindingData::GetNearestParentPackageJSONType( ToNamespacedPath(realm->env(), &path_value); std::string path_value_str = path_value.ToString(); + auto path_value_u8str = + std::u8string(path_value_str.begin(), path_value_str.end()); if (slashCheck) { - path_value_str.push_back(kPathSeparator); + path_value_u8str.push_back(kPathSeparator); } auto package_json = - TraverseParent(realm, std::filesystem::path(path_value_str)); + TraverseParent(realm, std::filesystem::path(path_value_u8str)); if (package_json == nullptr) { return;