Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Revert "Windows: support non-ansi command line arguments"
Browse files Browse the repository at this point in the history
CommandLineToArgvW doesn't behave exactly the same as the crt, which makes it useless.
This reverts commit ef032cb.
  • Loading branch information
piscisaureus committed Feb 16, 2012
1 parent 3415427 commit 9364699
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/node.cc
Expand Up @@ -2032,40 +2032,12 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
process->Set(String::NewSymbol("platform"), String::New(PLATFORM));

// process.argv
#ifdef _WIN32
// Windows - use unicode
WCHAR* command_line = GetCommandLineW();
if (command_line == NULL) {
winapi_perror("GetCommandLineW");
exit(1);
}

int wargc = 0;
WCHAR** wargv = CommandLineToArgvW(command_line, &wargc);
if (wargv == NULL || wargc <= 0) {
winapi_perror("CommandLineToArgvW");
exit(1);
}

assert(wargc == argc);

Local<Array> arguments = Array::New(wargc - option_end_index + 1);
arguments->Set(Integer::New(0), String::New(reinterpret_cast<uint16_t*>(wargv[0])));
for (j = 1, i = option_end_index; i < wargc; j++, i++) {
Local<String> arg = String::New(reinterpret_cast<uint16_t*>(wargv[i]));
arguments->Set(Integer::New(j), arg);
}

LocalFree(wargv);
#else
// Unix
Local<Array> arguments = Array::New(argc - option_end_index + 1);
arguments->Set(Integer::New(0), String::New(argv[0]));
for (j = 1, i = option_end_index; i < argc; j++, i++) {
Local<String> arg = String::New(argv[i]);
arguments->Set(Integer::New(j), arg);
}
#endif
// assign it
process->Set(String::NewSymbol("argv"), arguments);

Expand Down

0 comments on commit 9364699

Please sign in to comment.