Recent

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

wittbo

  • Full Member
  • ***
  • Posts: 138
[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.0.10
iMac with MacOS 10.13.6 / Lazarus 2.0.2

wp

  • Hero Member
  • *****
  • Posts: 7551
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.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

wittbo

  • Full Member
  • ***
  • Posts: 138
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.0.10
iMac with MacOS 10.13.6 / Lazarus 2.0.2

wp

  • Hero Member
  • *****
  • Posts: 7551
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)
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 946
  • 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.
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

 

TinyPortal © 2005-2018