discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

__APPLE__ feature test macro (Was: Running a command using NSTask)


From: Wolfgang Lux
Subject: __APPLE__ feature test macro (Was: Running a command using NSTask)
Date: Mon, 22 Nov 2010 08:48:33 +0100

Csanyi Pal wrote:

I shall use methods you adviced to me for OS X using:

#ifdef __APPLE__
  // get a list of the directories the program might be in
  // NSSearchPathForDirectoriesInDomains()
  // append your program name to each directory in turn
  // [NSString-stringByAppendingPathComponent:]
  // check each to see if the program is there
  // [NSFileManager-isExecutableFileAtPath:]
#endif /*  __APPLE__ */

Please Csanyi (and everybody else) *NEVER* use #ifdef __APPLE__ to check whether you are using Apple's Cocoa implementation. The feature test macro __APPLE__ just tells you that you are compiling on an Apple machine (and in fact OS X, it was not defined in Classic Mac OS). However, it does not mean that the GNUstep extensions are not available; you could either be compiling with the GNUstep extensions (the apple-apple-apple configuration of GNUstep) or with a full GNUstep installation (gnu-gnu-gnu configuration) on OS X.

If you do not explicitly import the GNUstep extensions (in which case you can assume presence of the extensions of course), a better way of checking their presence is
  #ifdef __GNUSTEP_BASE_VERSION__
or
  #ifdef __GNUSTEP_GUI_VERSION__
depending on whether it is a Foundation or AppKit class extension.

Wolfgang




reply via email to

[Prev in Thread] Current Thread [Next in Thread]