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

Error: expression has no address
MD5 on an array, array[0..63, uint8] to cstring conversion
Converting a seq[char] to string
Nim: On mac, cannot open standard import
How to compare two typedesc in a template for equality
Is there a “default” file name that can be used for importing modules?
Unable to get StringStream created from marshal to output the data
Initialize a seq of seqs
How to change Nim compiler output file location and name
Compile-time Call Count in Nim
How To Convert Slice To Sequence?
Cannonical way to do circular dependency in Nim
toSeq(some_string) Type Mismatch
Why is there a warning not to use system.cmp[string] for Nim string comparison
What's the the best way to get the current operating system?
How to get the type of a value as string?

Categories

HOME
notepad++
beautifulsoup
embedded
hyperlink
deep-learning
eslint
ggplot2
github-for-windows
angular2-material
grafana
spring-data-mongodb
soa
jetty
tvos
nstableheaderview
special-characters
okhttp
mql5
drop-down-menu
reactive-programming
github-enterprise
datastage
php-5.6
supervisor
zerobrane
package-managers
standards
vuejs
asp.net-mvc-viewmodel
nim
articulate-storyline
react-toolbox
postscript
parcelable
onload
google-cloud-print
uitapgesturerecognizer
constexpr
angularjs-material
spring-security4
biztalk-rule-engine
dynamic-jasper
reactjs.net
yowsup
getlasterror
reactivekit
release
linq-to-objects
signals-slots
congestion-control
berkeley-db-je
photos
openal
mschart
tinymce-3
payara-micro
oracleclient
edit
mouseleave
trigger.io
branch-prediction
juice-ui
vcloud-director-rest-api
materialized-path-pattern
parfor
pacemaker
xcode-server
expectations
android-dateutils
observablecollection
android-wake-lock
database-relations
mobiledoc-kit
atan2
character-replacement
lazybones
jdi
dock
.bash-profile
sql-server-data-tools
nutiteq
ms-access-2000
mraid
rrule
uncaught-typeerror
cbind
strawberry-perl
xml-dsig
functional-java
terminate
git-repo
ecslidingviewcontroller
cocoalibspotify-2.0
printdialog
ui-select2
abstract-data-type
server-administration
mysql-error-2013
dajaxice
screen-size
mtu
filesystemobject
asynchronous-wcf-call
technical-debt
blind

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