On Sat, 9 Feb 2013, Bart wrote:
On 2/9/13, Michael Van Canneyt <mich...@freepascal.org> wrote:
Like I said, we can imagine a parameter 'AllowCreate' or 'ForceCreate'.
GetAppConfigDir(Global : Boolean: ForceCreate: Booelan = false) : String;
While this can easily be implemented without breaking existing code,
this still does not solve the original problem.
If creating the directory fails, the function does not return an
errorcode, unless we decide to let it raise an exception in this
case..
Which is why I said 'we can imagine':
I didn't investigate all angles yet...
Common programming sense would be to query the desired location, and
if it does not exists, try and create it,(for this the ForeceCreate
parameter is usefull) __and check__ if this went OK.
So, no matter how we change the GetAppConfigDir() function, it will
always require code for checking if all went OK.
There is only one way:
if the ForceCreate is implemented and if creation fails, an exception
will be raised.
In which case the
TIniFile.Create(...)
and so forth will not be executed, and probably many other things will
go wrong as well....
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal