On Wed, 16 Mar 2011, Peter Williams wrote:
Hi Sven,
> Date: Tue, 15 Mar 2011 16:02:55 +0100
> From: [email protected]
> To: [email protected]
> Subject: Re: [Lazarus] Unable to rewrite .ini file which exists... error
unable to create
.ini file. (need to rewrite it).
>
> Am 15.03.2011 15:51, schrieb Peter Williams:
> > I just tried calling Str1 := GetAppConfigDir(true); ShowMessage(Str1);
> >
> > and my app is called Color_Life.exe and it returns
> > "C:\ProgramData\Color_Life\". Since the folder "C:\ProgramData\" exists
> > and it's subfolder "\Color_Life\" does NOT exist, then does this mean
> > that I need to create it myself, or will my call to one of the
> > "MemIniFiles" procedures create the folder for me?
>
> You need to create the path yourself. As I said: those functions just
> return a string. What you do with it, is up to you.
var
str1 : string;
begin
str1 := GetAppConfigDir( true );
ShowMessage( Str1 );
// note: for Fred.exe returns C:\ProgramData\Fred\
if not DirectoryExists(Str1) then
// Create Directory Str1
// call to 'mkdir' ??? what about on Linux??? and other platforms?
What is the cross-platform way for me to create the directory in Str1 (as
returned by
GetAppConfigDir) ?
use ForceDirectories from the Sysutils unit:
http://www.freepascal.org/docs-html/rtl/sysutils/forcedirectories.html
Michael.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus