Hi Bart,
> Date: Tue, 15 Mar 2011 12:45:49 +0100 > From: bartjun...@gmail.com > To: lazarus@lists.lazarus.freepascal.org > Subject: Re: [Lazarus] Unable to rewrite .ini file which exists... error > unable to create .ini file. (need to rewrite it). > > On 3/15/11, Peter Williams <pewilliams2...@live.com> wrote: > > > ConfigIni := TIniFile.Create(ChangeFileExt(Application.ExeName,'.ini')); > > You really should not do that in most OS's, even on Windows it is > deprecated since win9x. > Most times you will not have write permissions there. > Also under *nix this location might not be what you expect it to be... > > Use GetAppConfigDir to determine where to put INI files. I found the declaration for function GetAppConfigDir in osutilsh.inc but I cannot find the actual function (I am looking in the wrong file). Function GetAppConfigDir(Global : Boolean) : String;Function GetAppConfigFile(Global : Boolean) : String;Function GetAppConfigFile(Global : Boolean; SubDir : Boolean) : String; What is the "Global : Boolean" parameter that it takes? Can someone please give me an example as to how it is called? Thanks,PEW osutilsh.inc --- { This file is part of the Free Pascal run time library. Copyright (c) 1999-2000 by Michael Van Canneyt member of the Free Pascal development team See the file COPYING.FPC, included in this distribution, for details about the copyright. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. **********************************************************************} Type TExecuteFlags = Set of ( ExecInheritsHandles); { OS handling utilities } {$ifdef HAS_OSERROR}Function GetLastOSError : Integer;{$endif}Procedure RaiseLastOSError;Function GetEnvironmentVariable(Const EnvVar : String) : String;Function GetEnvironmentVariableCount : Integer;Function GetEnvironmentString(Index : Integer) : String;{$IFDEF HAS_SLEEP}procedure Sleep(milliseconds: Cardinal);{$ENDIF}function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString;Flags:TExecuteFlags=[]):integer;function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString;Flags:TExecuteFlags=[]):integer; Function GetTempDir(Global : Boolean) : String;Function GetTempDir : String;Function GetTempFileName(Const Dir,Prefix : String) : String;Function GetTempFileName : String;{ For windows compatibility }function GetTempFileName(Dir,Prefix: PChar; uUnique: DWORD; TempFileName: PChar):DWORD;Function GetAppConfigDir(Global : Boolean) : String;Function GetAppConfigFile(Global : Boolean) : String;Function GetAppConfigFile(Global : Boolean; SubDir : Boolean) : String;Function GetUserDir : String;Function VendorName : String;Function ApplicationName : String; Const ConfigExtension : String = '.cfg'; SysConfigDir : String = ''; Type TGetVendorNameEvent = Function : String; TGetAppNameEvent = Function : String; TGetTempDirEvent = Function (Global : Boolean) : String; TGetTempFileEvent = Function (Const Dir,Prefix : String) : String; Type TEventType = (etCustom,etInfo,etWarning,etError,etDebug); Var OnGetVendorName : TGetVendorNameEvent; OnGetApplicationName : TGetAppNameEvent; OnGetTempDir : TGetTempDirEvent; OnGetTempFile : TGetTempFileEvent; > > Bart > > -- > _______________________________________________ > Lazarus mailing list > Lazarus@lists.lazarus.freepascal.org > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus