Fix developer shell build on Windows.

Fixed the OS check in the SCons build. Moved SetEnvironment to platform file as Windows does not have setenv. Added the d8-windows.cc to the Visual Studio project.
Review URL: http://codereview.chromium.org/57050

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1649 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
sgjesse@chromium.org 2009-03-31 11:45:20 +00:00
parent 1f7a7d9c58
commit 745cccdcba
5 changed files with 34 additions and 23 deletions

View File

@ -95,7 +95,7 @@ D8_FILES = {
'os:freebsd': [
'd8-posix.cc'
],
'os:windows': [
'os:win32': [
'd8-windows.cc'
],
'os:nullos': [

View File

@ -538,4 +538,26 @@ Handle<Value> Shell::ChangeDirectory(const Arguments& args) {
}
Handle<Value> Shell::SetEnvironment(const Arguments& args) {
if (args.Length() != 2) {
const char* message = "setenv() takes two arguments";
return ThrowException(String::New(message));
}
String::Utf8Value var(args[0]);
String::Utf8Value value(args[1]);
if (*var == NULL) {
const char* message =
"os.setenv(): String conversion of variable name failed.";
return ThrowException(String::New(message));
}
if (*value == NULL) {
const char* message =
"os.setenv(): String conversion of variable contents failed.";
return ThrowException(String::New(message));
}
setenv(*var, *value, 1);
return v8::Undefined();
}
} // namespace v8

View File

@ -49,4 +49,11 @@ Handle<Value> Shell::ChangeDirectory(const Arguments& args) {
}
Handle<Value> Shell::SetEnvironment(const Arguments& args) {
Handle<String> error_message =
String::New("setenv() is not yet supported on your OS");
return ThrowException(error_message);
}
} // namespace v8

View File

@ -163,28 +163,6 @@ Handle<Value> Shell::Print(const Arguments& args) {
}
Handle<Value> Shell::SetEnvironment(const Arguments& args) {
if (args.Length() != 2) {
const char* message = "setenv() takes two arguments";
return ThrowException(String::New(message));
}
String::Utf8Value var(args[0]);
String::Utf8Value value(args[1]);
if (*var == NULL) {
const char* message =
"os.setenv(): String conversion of variable name failed.";
return ThrowException(String::New(message));
}
if (*value == NULL) {
const char* message =
"os.setenv(): String conversion of variable contents failed.";
return ThrowException(String::New(message));
}
setenv(*var, *value, 1);
return v8::Undefined();
}
Handle<Value> Shell::Load(const Arguments& args) {
for (int i = 0; i < args.Length(); i++) {
HandleScope handle_scope;

View File

@ -157,6 +157,10 @@
RelativePath="..\..\src\d8-debug.h"
>
</File>
<File
RelativePath="..\..\src\d8-windows.cc"
>
</File>
<File
RelativePath="..\..\src\d8.js"
>