Is it possible to determine on which platform (GNU/Linux, Win32, OS X) my Vala app is running?
相关问题
- Advice for supporting both Mac and Windows Desktop
- GstMultifilesink post-messages callback
- How to make a column with a string and pixbuf in G
- Cross-platform definition of _byteswap_uint64 and
- Can SQL Server bcp in a file with Unix line ending
相关文章
- How do you make an installer for your python progr
- Libgdx - Check if a key is being held down?
- Is there a non-java, cross platform way to launch
- How to get a settings storage path in a cross-plat
- Is there a standard way to get the user config dir
- Cross platform audio analysis library
- How to disable outside clicks while an element is
- What's a good User-Agent parsing plugin for dj
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++.