4

I'm trying to detect the operating system's natural look and feel so I style my elements close to the feel of the OS (e.g. Skeuomorph or Flat).

Currently, I am using NodeJS's 'os' module for getting OS information. On the Mac [Mavericks] I can get the value 'darwin' via os.platform(), which according to wiki, is also what Yosemite is called.

My main aim is to detect if the OS uses a flat design (e.g. the new Windows8 or Mac's Yosemite) or the traditional skeuomorph design.

Is there are list of the platform names for the various OS's?
- OR alternatively - Is there a easier/better method to detect if the OS uses a flat or skeuomorph design?

Guy Park
  • 959
  • 12
  • 25
  • You can use `os.release()` to determine the version. For example, it returns `6.1.xxxx` on Windows 7, which is [NT 6.1](http://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions#Device_versions) – Ben Fortune May 06 '15 at 08:57
  • Thanks Ben, I've looked at that, but on my Mac (Mavericks) i get 13.4.5, which is nothing like the OS's actual 10.9 version number. What is needed is a list of what numbers/strings mean what OS, so I can build in that logic... – Guy Park May 07 '15 at 03:53
  • That's the underlying version of Darwin. You can cross-reference them with the OSX version [here.](http://en.m.wikipedia.org/wiki/Darwin_%28operating_system%29) – Ben Fortune May 07 '15 at 07:25

1 Answers1

3

Quoting answer from here.

There is now an os module: Node OS Module Docs. It has a function for getting the platform os.platform

The docs don't give return values. So, I've documented some below. Results are for Ubuntu 12.04 64-bit, OS X 10.8.5, Windows 7 64-bit and a Joyent SmartMachine, respectively. Tests conducted on Node 0.10.

Linux

  • os.type() : 'Linux'
  • os.platform() : 'linux'
  • os.arch() : 'x64'

OS X (Mac)

  • os.type() : 'Darwin'
  • os.platform() : 'darwin'
  • os.arch() : 'x64'

Windows

  • os.type() : 'Windows_NT'
  • os.platform() : 'win32'
  • os.arch() : 'x64'

SmartMachine

  • os.type() : 'SunOS'
  • os.platform() : 'sunos'
  • os.arch() : 'ia32'

Note: on Windows 7 64-bit node may incorrectly report os.arch() as ia32. This is a documented bug: os.arch should be the architecture of the OS not of the process

Community
  • 1
  • 1
Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156