@@ -123,7 +123,7 @@ void ProcessRunner::SetEnvironmentVariables() { |
123 | 123 | // Add NODE_RUN_PACKAGE_JSON_PATH environment variable to the environment to |
124 | 124 | // indicate which package.json is being processed. |
125 | 125 | env_vars_.push_back("NODE_RUN_PACKAGE_JSON_PATH=" + |
126 | | - package_json_path_.string()); |
| 126 | + ConvertPathToUTF8(package_json_path_)); |
127 | 127 |
|
128 | 128 | env_ = std::unique_ptr<char*[]>(new char*[env_vars_.size() + 1]); |
129 | 129 | options_.env = env_.get(); |
@@ -206,7 +206,7 @@ void ProcessRunner::OnExit(int64_t exit_status, int term_signal) { |
206 | 206 |
|
207 | 207 | void ProcessRunner::Run() { |
208 | 208 | // keeps the string alive until destructor |
209 | | - cwd_ = package_json_path_.parent_path().string(); |
| 209 | + cwd_ = ConvertPathToUTF8(package_json_path_.parent_path()); |
210 | 210 | options_.cwd = cwd_.c_str(); |
211 | 211 | if (int r = uv_spawn(loop_, &process_, &options_)) { |
212 | 212 | fprintf(stderr, "Error: %s\n", uv_strerror(r)); |
@@ -228,14 +228,14 @@ FindPackageJson(const std::filesystem::path& cwd) { |
228 | 228 | // Append "path/node_modules/.bin" to the env var, if it is a directory. |
229 | 229 | auto node_modules_bin = directory_path / "node_modules" / ".bin"; |
230 | 230 | if (std::filesystem::is_directory(node_modules_bin)) { |
231 | | - path_env_var += node_modules_bin.string() + env_var_separator; |
| 231 | + path_env_var += ConvertPathToUTF8(node_modules_bin) + env_var_separator; |
232 | 232 | } |
233 | 233 |
|
234 | 234 | if (raw_content.empty()) { |
235 | 235 | package_json_path = directory_path / "package.json"; |
236 | 236 | // This is required for Windows because std::filesystem::path::c_str() |
237 | 237 | // returns wchar_t* on Windows, and char* on other platforms. |
238 | | - std::string contents = package_json_path.string(); |
| 238 | + std::string contents = ConvertPathToUTF8(package_json_path); |
239 | 239 | USE(ReadFileSync(&raw_content, contents.c_str()) > 0); |
240 | 240 | } |
241 | 241 | } |
@@ -258,7 +258,7 @@ void RunTask(const std::shared_ptr<InitializationResultImpl>& result, |
258 | 258 | if (!package_json.has_value()) { |
259 | 259 | fprintf(stderr, |
260 | 260 | "Can't find package.json for directory %s\n", |
261 | | - cwd.string().c_str()); |
| 261 | + ConvertPathToUTF8(cwd).c_str()); |
262 | 262 | result->exit_code_ = ExitCode::kGenericUserError; |
263 | 263 | return; |
264 | 264 | } |
@@ -274,7 +274,7 @@ void RunTask(const std::shared_ptr<InitializationResultImpl>& result, |
274 | 274 | simdjson::ondemand::object main_object; |
275 | 275 |
|
276 | 276 | if (json_parser.iterate(raw_json).get(document)) { |
277 | | - fprintf(stderr, "Can't parse %s\n", path.string().c_str()); |
| 277 | + fprintf(stderr, "Can't parse %s\n", ConvertPathToUTF8(path).c_str()); |
278 | 278 | result->exit_code_ = ExitCode::kGenericUserError; |
279 | 279 | return; |
280 | 280 | } |
@@ -283,9 +283,9 @@ void RunTask(const std::shared_ptr<InitializationResultImpl>& result, |
283 | 283 | if (root_error == simdjson::error_code::INCORRECT_TYPE) { |
284 | 284 | fprintf(stderr, |
285 | 285 | "Root value unexpected not an object for %s\n\n", |
286 | | - path.string().c_str()); |
| 286 | + ConvertPathToUTF8(path).c_str()); |
287 | 287 | } else { |
288 | | - fprintf(stderr, "Can't parse %s\n", path.string().c_str()); |
| 288 | + fprintf(stderr, "Can't parse %s\n", ConvertPathToUTF8(path).c_str()); |
289 | 289 | } |
290 | 290 | result->exit_code_ = ExitCode::kGenericUserError; |
291 | 291 | return; |
@@ -294,8 +294,9 @@ void RunTask(const std::shared_ptr<InitializationResultImpl>& result, |
294 | 294 | // If package_json object doesn't have "scripts" field, throw an error. |
295 | 295 | simdjson::ondemand::object scripts_object; |
296 | 296 | if (main_object["scripts"].get_object().get(scripts_object)) { |
297 | | - fprintf( |
298 | | - stderr, "Can't find \"scripts\" field in %s\n", path.string().c_str()); |
| 297 | + fprintf(stderr, |
| 298 | + "Can't find \"scripts\" field in %s\n", |
| 299 | + ConvertPathToUTF8(path).c_str()); |
299 | 300 | result->exit_code_ = ExitCode::kGenericUserError; |
300 | 301 | return; |
301 | 302 | } |
@@ -309,13 +310,13 @@ void RunTask(const std::shared_ptr<InitializationResultImpl>& result, |
309 | 310 | "Script \"%.*s\" is unexpectedly not a string for %s\n\n", |
310 | 311 | static_cast<int>(command_id.size()), |
311 | 312 | command_id.data(), |
312 | | - path.string().c_str()); |
| 313 | + ConvertPathToUTF8(path).c_str()); |
313 | 314 | } else { |
314 | 315 | fprintf(stderr, |
315 | 316 | "Missing script: \"%.*s\" for %s\n\n", |
316 | 317 | static_cast<int>(command_id.size()), |
317 | 318 | command_id.data(), |
318 | | - path.string().c_str()); |
| 319 | + ConvertPathToUTF8(path).c_str()); |
319 | 320 | fprintf(stderr, "Available scripts are:\n"); |
320 | 321 |
|
321 | 322 | // Reset the object to iterate over it again |
|