Neater "not version (...)" ?

Vladimirs Nordholm v at vladde.net
Wed Sep 16 19:03:25 UTC 2020


On Wednesday, 16 September 2020 at 18:07:25 UTC, Ferhat Kurtulmuş 
wrote:
> On Wednesday, 16 September 2020 at 17:53:31 UTC, Vladimirs 
> Nordholm wrote:
>> Hello.
>>
>> I wonder if there is a better way to compile something if the 
>> current operating system is _not_ a specific platform.
>>
>> For example, I only want some code to compile if the operating 
>> system is not Windows. Currently I do this:
>>
>>     version (Windows)
>>     {
>>     }
>>     else
>>     {
>>         // ... my code
>>     }
>>
>> Is there a neater version of this, like `!version (Windows) { 
>> /+ ... my code +/ }` ?
>
> Not what you may want, but a dub solution is available.
> "excludeSourceFiles-windows" : ["source/someunixcode.d"]

Unfortunately for my use case this does not work here. Thanks for 
the tip though!


More information about the Digitalmars-d-learn mailing list