Browse Source

Implement os.isWindows

v0.7.4-release
Bert Belder 14 years ago
committed by Ryan Dahl
parent
commit
9e31e0837e
  1. 4
      doc/api/os.markdown
  2. 1
      lib/os.js
  3. 6
      src/node_os.cc

4
doc/api/os.markdown

@ -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.

1
lib/os.js

@ -8,3 +8,4 @@ exports.totalmem = binding.getTotalMem;
exports.cpus = binding.getCPUs;
exports.type = binding.getOSType;
exports.release = binding.getOSRelease;
exports.isWindows = binding.isWindows;

6
src/node_os.cc

@ -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
}

Loading…
Cancel
Save