cross platform - Is OS detection possible with GLib? -


is possible determine on platform (gnu/linux, win32, os x) vala app running?

as vala compiled language (as opposed intermediate or interpreted) can determine platform using favorite build tool , use conditional compilation.

something like:

#if windows     message ("running on windows"); #elif osx     message ("running on os x"); #elif linux     message ("running on gnu/linux"); #elif posix     message ("running on other posix system"); #else     message ("running on unknown os"); #endif 

the build tool have pass -d linux, etc compiler.

i careful , last resort, because can backfire. it's better use cross platform libraries handle differences you.

btw: see how done in c++.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -