[Lazarus] Two simple questions

Paul Ishenin ip at kmiac.ru
Thu Jul 16 09:30:46 CEST 2009


Guadagnini David wrote:

> 1) How define I must use for check (during the compilation) if the 
> compiler is Delphi or Lazarus ?

Lazarus is not a compiler :) You can check if you are using fpc by
{$ifdef fpc}. Delphi does not have similar define but you can check for 
paticular delphi version using:

{$IFDEF VER120}      // Delphi 4.0
   {$DEFINE DELPHI_4UP}
{$ENDIF}

{$IFDEF VER130}      // Delphi 5.0
   {$DEFINE DELPHI_4UP}
   {$DEFINE DELPHI_5UP}
{$ENDIF}

...

> 2) How define I must use for check if the program is for Windows, Linux 
> or MAC ?

windows: {$ifdef Windows} or {$ifdef MSWindows}
linux: {$ifdef linux}
osx: {$ifdef darwin}

> Another think.. I need to manipulate the files attributes (in this 
> particular case the attribute Read-Only). For change this attribute how 
> I can work in Linux or Max (I Know only the Windows method)


FileSetAttr or FileSetAttrUTF8 depends on how your filename string is 
encoded.

Best regards,
Paul Ishenin.





More information about the Lazarus mailing list