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:
parent
1f7a7d9c58
commit
745cccdcba
@ -95,7 +95,7 @@ D8_FILES = {
|
||||
'os:freebsd': [
|
||||
'd8-posix.cc'
|
||||
],
|
||||
'os:windows': [
|
||||
'os:win32': [
|
||||
'd8-windows.cc'
|
||||
],
|
||||
'os:nullos': [
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
22
src/d8.cc
22
src/d8.cc
@ -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;
|
||||
|
@ -157,6 +157,10 @@
|
||||
RelativePath="..\..\src\d8-debug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\d8-windows.cc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\d8.js"
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user