Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-07

Two simple questions

8 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Guadagnini David

Dear people, I have two simple questions for us:

1) How define I must use for check (during the compilation) if the compiler is Delphi or Lazarus ?
2) How define I must use for check if the program is for Windows, Linux or MAC ?

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)

Thanks alot and sorry for my very bad English,
David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sw_dept.vcf
Type: text/x-vcard
Size: 257 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20090716/e4fbff6b/attachment.vcf>

Reply by email

Paul Ishenin
to Guadagnini David
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.

Reply by email

Guadagnini David
to Paul Ishenin

Thanks alot... another one (the last I hope)..

in Windows the library ImageHlp.Dll contain the routine MakeSureDirectoryPathExists that is used for create a complete directory tree (for example c:\1\2\3\4...).
in Linux or Mac exist a similar function?

David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sw_dept.vcf
Type: text/x-vcard
Size: 257 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20090716/3ee50241/attachment.vcf>

Reply by email

Vincent Snijders
to Guadagnini David
Guadagnini David wrote 6 lines
Thanks alot... another one (the last I hope).. in Windows the library ImageHlp.Dll contain the routine MakeSureDirectoryPathExists that is used for create a complete directory tree (for example c:\1\2\3\4...). in Linux or Mac exist a similar function?

http://lazarus-ccr.sourceforge.net/docs/lcl/fileutil/forcedirectory.html http://lazarus-ccr.sourceforge.net/docs/lcl/fileutil/forcedirectoriesutf8.html

Vincent

Reply by email

Guadagnini David
to Guadagnini David: Thanks alot... another one (the last I hope).. in Windows the library ImageHlp.Dll…

Dear,

someone know why the procedures AssignFile and CloseFile are stored into the OBJPas unit and not into the System unit how in Delphi?

David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sw_dept.vcf
Type: text/x-vcard
Size: 257 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20090716/fa4277bf/attachment.vcf>

Reply by email

Michael Van Canneyt
to Guadagnini David
Guadagnini David wrote
Dear, someone know why the procedures AssignFile and CloseFile are stored into the OBJPas unit and not into the System unit how in Delphi?

Because the system unit contains only TP compatible methods. The objpas unit is loaded in ObjFPC or DELPHI mode together with the system unit. This is usually no problem, unless someone used system.assignfile explicitly.

Michael.

Reply by email

Guadagnini David
to Michael Van Canneyt
This is usually no problem, unless someone used system.assignfile

explicitly.

I use this method in some object that rewrite the file managment routine, but is not a problem, thanks

david

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sw_dept.vcf
Type: text/x-vcard
Size: 257 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20090716/1ebab198/attachment.vcf>

Reply by email

Guadagnini David
to Vincent Snijders: http://lazarus-ccr.sourceforge.net/docs/lcl/fileutil/forcedirectory.html…

Wow thank

David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sw_dept.vcf
Type: text/x-vcard
Size: 257 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20090716/51162488/attachment.vcf>

Reply by email