Is it possible to determine on which platform (GNU/Linux, Win32, OS X) my Vala app is running?
Is OS detection possible with GLib?
408 Views Asked by tpimh At
1
There are 1 best solutions below
Related Questions in CROSS-PLATFORM
- How to tell the difference between linux and mac
- Possible to ignore certain submodules on Git checkout?
- Swipe between webviews in Xamarin
- How to invoke an Integration Service in Kony Studio that is created in the MobileFabric Console?
- Kony: Ant build error=exec-shell returned: 1
- Best practice for cross-platform mono project layout when using native dll's
- Equivalents to gcc/clang's march=native in other compilers?
- Platform specific cut paste mnemonics swing.
- Are there any naming conventions for command line arguments?
- Why is NetBeans running my program on OS X, but not building it into a JAR?
- How to Upgrade Cordova 3.5.0-0.2.4 to any higher version?
- Meteor.js - How to implement different templates on a cross-platform app
- Rcpp: Platform differences in output
- Cross-Platform Vector Format
- How to manage separate GUI processes in a Qt application?
Related Questions in GLIB
- Using the glib on Android : undefined reference to 'g_thread_init'
- Will this example code for g_cond_wait() lead to undefined behaviour?
- Convert int to Glib::ustring w/o stringstream
- ImageView giving glib error
- Run a function at every iteration of a GLib.MainLoop
- Kurento media server error (GLib-CRITICAL)
- (Python) glib MonitorObserver return two exception when attach (or detach) usb device. Why?
- Use of sizeof() with normal arrays and garrays
- Segmentation fault : g_ptr_array_foreach
- How do you create a dictionary that maps onto an array in GLib?
- destroying a class instance doesn't kill instances it owns in vala
- Can't create thread in vala: `GLib.Thread' does not have a default constructor
- Accessing system dbus twice gives segmentation fault
- How can I print the Jsonarray in json-Glib?
- How can I add many json strings in one JsonArray?
Related Questions in VALA
- Async Function in Vala - Yield & Callback
- About good practice for GLib.Application and Soup.Server
- Ubuntu compile Vala for Windows
- Multiple fields in one line
- Return int reference in vala
- Vala: Understanding Struct Properties in Classes
- GtkStyleProvider - providing own implementation
- Inheriting interface in Vala - incompatible with base method
- How to determine present operating system (including specific distribution in the case of Linux) in a Vala program?
- Hiding transition in Gtk
- Custom GTK widget with Vala
- how to remove the -j9 option from the build process in gnome-builder
- Vala: MySQLprogram not compiling
- Vala generates deprecated warnings for higher GTK/GDK Versions
- destroying a class instance doesn't kill instances it owns in vala
Related Questions in OS-DETECTION
- remote OS detection in python
- Show or Hide Div based on OS
- tell if make is running on windows or linux
- How to detect Mac OS X version using C preprocessor?
- Get users OS and version number
- Where does the OS take the value for $OSTYPE
- How can I detect IOS version with server code at cshtml?
- How to guess the most likely OS and interpret it when using nmap
- JavaScript to detect OS in Chrome Version 37.0.2062.94
- OS detecting makefile
- Is there a way to distinguish Android Arm os from the Android x86 os in JavaScript?
- How to detect Android OS from a Python script?
- how to detect MacOS Sierra version in plain javascript
- OS detection to display different links on WordPress page
- Is there methods to detect Windows-11 vs Windows-10 in Firefox browser?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
As Vala is a compiled language (as opposed to intermediate or interpreted) you can determine the platform using your favorite build tool and use conditional compilation.
Something like:
The build tool would have to pass
-D LINUX, etc to the compiler.I would be careful and only do something like this as a last resort, because it can backfire. Usually it's better to use cross platform libraries that already handle the differences for you.
BTW: See also how this is done in C++.