[Lazarus] How to add & change application EnvironmentList ?

FreeMan freeman35 at delphiturkiye.com
Wed Aug 26 21:45:31 CEST 2015


On 26.08.2015 22:22, Michael Van Canneyt wrote:
> I understand this. That is exactly what AProcess.Environment does.
>
> Michael.

       AProcess.Environment.Add('LD_LIBRARY_PATH=' + fb_RootPath);
       AProcess.Environment.Add('FIREBIRD=' + fb_RootPath);
       for I := 0 to GetEnvironmentVariableCount do begin
         AProcess.Environment.Add(GetEnvironmentString(I));
         Form1.Memo1.Lines.Add(AProcess.Environment.Strings[I]);
       end;

       Form1.Memo1.Lines.Add('');
       Form1.Memo1.Lines.Add('-------------------------------');
       Form1.Memo1.Lines.Add('--------------------');
       Form1.Memo1.Lines.Add('');
  Application.GetEnvironmentList(Form1.Memo1.Lines);

this is result:
1-) AProcess.Environment result
LD_LIBRARY_PATH=/opt/proje_laz/projeler/shared/firebird/Embeded/test/fb_embed_linux64/
FIREBIRD=/opt/proje_laz/projeler/shared/firebird/Embeded/test/fb_embed_linux64/
KDE_FULL_SESSION=true
KDE_FULL_SESSION=true
GNOME_KEYRING_PID=1900
GS_LIB=/home/freeman/.fonts

................................
................................

2-)Application.GetEnvironmentList  result
KDE_FULL_SESSION=true
GNOME_KEYRING_PID=1900
GS_LIB=/home/freeman/.fonts


var AProcess: TProcess;
AProcess := TProcess.Create(Application);

AProcess is different class, is that synchronous with main application's 
EnvironmentList ? My test is say no. It's not work in same session. For 
test I made bash sript, I wrote in export bla bla then execute it with 
tprocess, but not added to application's EnvironmentList.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150826/614afc9e/attachment-0003.html>


More information about the Lazarus mailing list