Recent

Author Topic: [SOLVED] Where is the location of XMLPropStorage file?  (Read 1388 times)

wittbo

  • Full Member
  • ***
  • Posts: 150
[SOLVED] Where is the location of XMLPropStorage file?
« on: January 21, 2020, 09:20:49 am »
Actually I have started using TXMLPropStorage component to save my application windows locations. It works fine, but I cannot find the file, where those settings are stored. I left the xmlpropstorage.filename property blank, so I expected to find a file <programname>.xml in my project directory. But there isn't anything. And upon searching with finders file search I could not find more.
Does anyone know the name of that file and where to find it?
« Last Edit: January 21, 2020, 10:08:18 am by wittbo »
-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.2.4
MacStudio with MacOS 13.0.1 / Lazarus 2.2.4

wp

  • Hero Member
  • *****
  • Posts: 11854
Re: Where is the location of XMLPropStorage file?
« Reply #1 on: January 21, 2020, 09:50:27 am »
This is the source code of TXMLPropStorage.GetXMLFileName:
Code: Pascal  [Select][+][-]
  1. function TCustomXMLPropStorage.GetXMLFileName: string;
  2. begin
  3.   if (FFileName<>'') then
  4.     Result:=FFileName
  5.   else if csDesigning in ComponentState then
  6.     raise Exception.Create('TCustomXMLPropStorage.GetXMLFileName: missing Filename')
  7.   else
  8.     {$ifdef unix}
  9.     Result:=IncludeTrailingPathDelimiter(GetEnvironmentVariableUTF8('HOME'))
  10.             +'.'+ExtractFileName(Application.ExeName);
  11.  
  12.     {$else}
  13.     Result:=ChangeFileExt(Application.ExeName,'.xml');
  14.     {$endif}
  15.   //debugln('TCustomXMLPropStorage.GetXMLFileName "',Result,'"');
  16. end;
It says that, when "FileName" is not specified, the xml file is stored alongside with the exe unless you are on Unix/Linux where it goes as a hidden file into your home directory under the name of the project.

wittbo

  • Full Member
  • ***
  • Posts: 150
Re: Where is the location of XMLPropStorage file?
« Reply #2 on: January 21, 2020, 10:07:56 am »
Thanks, wp. I just found the source too, and the .<programname> file.
That means, macOS behaves just like UNIX in this case.

I got a little bit confused, as I read the Wiki about TXMLPropStorage and was expecting a XML File and could not find anything...

And for me, this component works well, I dropped the component on each window, assigned the window session properties and quite easy, the positions of each window are saved in the same file and get restored upon program start.
-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.2.4
MacStudio with MacOS 13.0.1 / Lazarus 2.2.4

wp

  • Hero Member
  • *****
  • Posts: 11854
Re: Where is the location of XMLPropStorage file?
« Reply #3 on: January 21, 2020, 10:24:55 am »
I got a little bit confused, as I read the Wiki about TXMLPropStorage and was expecting a XML File and could not find anything...
Updated the wiki (only English and German versions, though... -- this is a severe problem of the wiki infrastructure that when an error is corrected in one translation it still exists in the others)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: [SOLVED] Where is the location of XMLPropStorage file?
« Reply #4 on: January 22, 2020, 04:44:53 am »
I updated the Portugese and French versions.

As for the translations issue - agreed. The English version is usually up-to-date, but the rest can be very out of date.

 

TinyPortal © 2005-2018