Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-10

GetAppConfigDir Question

14 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lee Jenkins

Are there any similar methods which I can use to get the root directory inside of which Lazarus/fpc create the folder named after the application. For instance, on Windows Vista, GetAppConfigDir(True) returns the

Windows Vista:
C:\Program Data\AppName\

Linux:
/home/user/.config/AppName/

What I need is a way to get these portions in a cross platform and uniform way:

C:\Program Data\

or

/etc/project1/

This way I can create my own method which returns a specific sub-folder of my choosing.

I have different apps that store their configuration files in the same directory under the main application name. Getting the special folders location on Windows is no problem but I'm not sure about other platforms.

I figure I can parse the result of GetAppConfigDir(true) figured they may be a method in place.

Thanks,

Warm Regards, Lee

Reply by email

Graeme Geldenhuys
to Lee Jenkins
Lee Jenkins wrote
For instance, on Windows Vista, GetAppConfigDir(True) returns the

You can still use GetAppConfigDir, just override the OnGetApplicationName event and return the common application name you want to use.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Lee Jenkins
to Graeme Geldenhuys
Graeme Geldenhuys wrote 8 lines
On 22/10/2009, Lee Jenkins wrote: > For instance, on Windows Vista, GetAppConfigDir(True) returns the > You can still use GetAppConfigDir, just override the OnGetApplicationName event and return the common application name you want to use.

Ah, I see the definitions for it in osutilsh.inc now.

Excellent. Thanks, G.

Warm Regards, Lee

Reply by email

Graeme Geldenhuys
to Bart

2009/10/22 Bart :

- GetSpecialDir (e.g. "My Documents")

What's that going to return under Linux, FreeBSD, Mac OS X? For the first two, I know I don't have that directory anywhere on my drive.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Hans-Peter Diettrich
to Graeme Geldenhuys
> - GetSpecialDir (e.g. "My Documents") What's that going to return under Linux, FreeBSD, Mac OS X? For the first two, I know I don't have that directory anywhere on my drive.

Maybe KDE specific, at least I have ~/Documents on openSUSE Linux.

DoDi

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys: You can still use GetAppConfigDir, just override the OnGetApplicationName event and…

2009/10/22 Graeme Geldenhuys :

You can still use GetAppConfigDir, just override the OnGetApplicationName event and return the common application name you want to use.

In the event that other developers do not know how to use this feature, here is a code example. It seems not many developers know about this feature.

Lets say the default ApplicationName returns "project1", but no matter what my actual application name is, I would like to return a specific (custom) name instead.

This means that GetAppConfigDir(False) would normally have return the following path under Linux:
/home/<user>/.config/project1

With the code below, it will always return:
/home/<user>/.config/tutoradmin

-----------------------------
implemenation

// This function overrides the default application name
function MyCustomApplicationName: string;
begin
  Result := 'tutoradmin';
end;
constructor TMainForm.Create(AOwner: TComponent );
begin
  inherited Create(AOwner);
  OnGetApplicationName := @MyCustomApplicationName;
  lCfg := GetAppConfigDir(False) + PathDelim + 'settings.ini';
end;
-----------------------------
Show quoted text 11 lines
-- Regards, ?- Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/
Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Lee Jenkins: Ah, I see the definitions for it in osutilsh.inc now. Excellent. Thanks, G. Lee
Lee Jenkins wrote 13 lines
Graeme Geldenhuys wrote: > On 22/10/2009, Lee Jenkins wrote: >> For instance, on Windows Vista, GetAppConfigDir(True) returns the >> > > You can still use GetAppConfigDir, just override the > OnGetApplicationName event and return the common application name you > want to use. > Ah, I see the definitions for it in osutilsh.inc now. Excellent. Thanks, G.

They are also documented :-)

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt

2009/10/23 Michael Van Canneyt :

They are also documented :-)

And it took me 0.014 seconds to find with fpGUI DocView. :-) Hopefully I'll be able to release a beta in the next week or so, for public testing.

PS:
The fpdoc IPF output is looking beter and beter every day. Almost ready to supply a patch for fpdoc.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Marco van de Voort
to Graeme Geldenhuys
Graeme Geldenhuys wrote 7 lines
And it took me 0.014 seconds to find with fpGUI DocView. :-) Hopefully I'll be able to release a beta in the next week or so, for public testing. PS: The fpdoc IPF output is looking beter and beter every day. Almost ready to supply a patch for fpdoc.

Another patch has been entered btw. Delphi XML output.

Reply by email

Marco van de Voort
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
2009/10/23 Marco van de Voort : > > Another patch has been entered btw. Delphi XML output. What is that, Delphi XML? A new custom help format? If so, what viewer does that use?

No, it is more something like Codegear/Borland's own variant of fpdoc's own meta XML formats, that can then be pushed through Codegear's own helpfile generator.

It might be useful for htmlhelp2 (and maybe htmlhelp3 which comes out with the next Visual Studio I'm told, and I assume Delphi will support it with the version after)

I don't know much details for the rest btw, not even which SKU has this.

Reply by email

Hans-Peter Diettrich
to Marco van de Voort
Show quoted text 7 lines
>> Another patch has been entered btw. Delphi XML output. > What is that, Delphi XML? A new custom help format? If so, what > viewer does that use? No, it is more something like Codegear/Borland's own variant of fpdoc's own meta XML formats, that can then be pushed through Codegear's own helpfile generator.

I thought that CodeGear uses the HH2 to create helpfiles. Does CG now provide an help compiler for component/plugin writers?

DoDi

Reply by email

Marco van de Voort
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 9 lines
>>> Another patch has been entered btw. Delphi XML output. >> What is that, Delphi XML? A new custom help format? If so, what >> viewer does that use? > > No, it is more something like Codegear/Borland's own variant of fpdoc's own > meta XML formats, that can then be pushed through Codegear's own helpfile > generator. I thought that CodeGear uses the HH2 to create helpfiles.

Afaik yes. But there not all work is done by HH2. These XMLs must be processed first before HH2 can compress the result. Hence "codegear's helpfile generator".

Does CG now provide an help compiler for component/plugin writers?

I don't know much about Delphi helpfile generation. Not even if it is in all SKUs

Reply by email