0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

Implement os.isWindows

This commit is contained in:
Bert Belder 2011-01-05 03:30:27 +01:00 committed by Ryan Dahl
parent 468042fc84
commit 9e31e0837e
3 changed files with 12 additions and 1 deletions

View File

@ -14,6 +14,10 @@ Returns the operating system name.
Returns the operating system release.
### os.isWindows
True on windows, false otherwise.
### os.uptime()
Returns the system uptime in seconds.

View File

@ -7,4 +7,5 @@ exports.freemem = binding.getFreeMem;
exports.totalmem = binding.getTotalMem;
exports.cpus = binding.getCPUs;
exports.type = binding.getOSType;
exports.release = binding.getOSRelease;
exports.release = binding.getOSRelease;
exports.isWindows = binding.isWindows;

View File

@ -145,6 +145,12 @@ void OS::Initialize(v8::Handle<v8::Object> target) {
NODE_SET_METHOD(target, "getCPUs", GetCPUInfo);
NODE_SET_METHOD(target, "getOSType", GetOSType);
NODE_SET_METHOD(target, "getOSRelease", GetOSRelease);
#ifdef __POSIX__
target->Set(String::New("isWindows"), False());
#else // __MINGW32__
target->Set(String::New("isWindows"), True());
#endif
}