nim


What's the the best way to get the current operating system?


I'm looking for something similar to python's sys.platform, which returns 'linux', 'windows', etc, or even better, something like python's platform module which gives you the operating system, distribution, release version, etc.
when defined windows:
echo "I'm on Windows!"
elif defined linux:
echo "I'm on Linux!"
else:
echo "I'm on some other platform!"
when defined x86:
echo "x86 specific code!"
elif defined amd64:
echo "amd64 specific code!"
else:
echo "generic code!"
when (NimMajor,NimMinor,NimPatch) > (0,10,2):
echo "Such a modern Nim version!"
echo "OS: ", hostOS, ", CPU: ", hostCPU, ", cpuEndian: ", cpuEndian, ", NimVersion: ", NimVersion
This prints on my system:
I'm on Linux!
amd64 specific code!
Such a modern Nim version!
OS: linux, CPU: amd64, cpuEndian: littleEndian, NimVersion: 0.10.3

Related Links

Unable to build nimsuggest
Nim: How to check if a float is nan or inf?
How to help nim prove that indices from an iterator are disjoint (within parallel section)?
printing an array in Nim using echo
Nim stored procedure reference in tuple
Remove constant after compilation in Nim
How do I use a `concept` in Nim?
how to create an IntSet on the heap in nim?
How to benchmark few lines of code in nim?
what is nim type definition for generic procedure?
Does a nim library contain an argsort implementation or wrapper?
nim jester how to change static route and directory
nim linker error while linking to libsodium
Can countup and countdown iterators in Nim language be used in variable declaration?
How do I write unit test for code that should fail to compile in Nim?
Difference between void proc and void proc with discard

Categories

HOME
ggplot2
nunit
apache-spark-mllib
oracle-apex-5
spring-data-redis
grafana
seo
newrelic
visual-studio-emulator
regular-language
code-coverage
g++
pcl-crypto
gson
line
ipmitool
enterprise-architect
android-intent
video-editing
windows-xp
spring-async
ember-cli
postscript
easeljs
jquery-callback
ckfinder
entity-relationship-model
apktool
zend-debugger
mockjax
dynamic-jasper
sharding
batching
opensmpp
apache-stanbol
attributeerror
dbnull
subclipse
claims
chronicle-map
congestion-control
avcapturedevice
memory-mapping
rfc3339
ntvs
libgphoto2
openrasta
serde
robomongo
activeperl
reindex
skin
sundials
flac
trigger.io
baidu
sandcastle
chromium-os
flex-monkey
flex4.6
resourcemanager
greatest-n-per-group
respondcms
lua-telegram-bot
riot
spreadjs
data-protection
boost-serialization
kiosk
jbase
avisynth
oracle-spatial
page.js
text-search
visual-sourcesafe-2005
sql-server-data-tools
kubuntu
device-tree
paw
wcm
mobility
angular-carousel
android-framework
openargs
windows-embedded-standard
light
jammer
scrypt
scringo
cmmi
route-provider
actiondispatch
chart-director
intersect
midlet
fragmenttransaction
appjs
jsr286
expression-blend-4
workflow-services
landscape-portrait
catransform3d
w3c-geolocation
luajava
objective-j
ie-compatibility-mode
easyb
drupal-fivestar
murmurhash
echo3
google-wave
dsoframer
commercial-application

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App