On 3/2/13, Xiangrong Fang <xrf...@gmail.com> wrote:

> In order to write cross platform programs, shall I use ForceDirectories or
> ForceDirectoriesUTF8?  I would like to:

I would think that that depends on where you get the value for
ForceDirectories(UTF8) from.
If this vale is obtained from any widget (OpenDialog, TEdit, etc.) the
encoding of the value is in UTF-8.
If however you get the value as a commandline parameter, then it is in
system-encoding if you use ParamStr(), but in UTF-8 if you use
ParamStrUTF8().

So you would use:

Path := ParamStr(1);
ForceDirectories(Path);

or

Path := SelectDirectoryDialog1.FileName;
ForceDirectoriesUtf8(Path);

You need to be sure which encoding a string has when you pass it on to
such procedures/functions.

Bart

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to