Alan Mead wrote:
I have the following code in a function:

      {$IFDEF LINUX}
      Slash := '/';
      {$ENDIF}
      {$IFDEF WIN32}
      Slash := '\';
      {$ENDIF}

Obviously, FPC supports many other platforms. Is there a better way
to handle this?
Use DirectorySeparator constant from System unit or PathDelim from SysUtils unit. PathDelim is also Delphi-compatible.

Also, will this work if I ever cross-compile?
Those are just constants defined in some units. So they will always correspond to the target OS you are compiling to. So everything will work when you cross-compile.

> Is
there a way to detect this at run-time rather than compile time?

-Alan

Maybe I don't understand this question, but there's just no need to detect value for DirectorySeparator at run-time when this is already known at compile-time for all OSes.

Michalis.

_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to