Hmm, I wonder if this is what you expect ?
procedure TForm1.FormShow(Sender: TObject);
begin
memo1.append('Current = ' + GetCurrentDirUTF8());
memo1.append('PWD = ' + GetEnvironmentVariable('PWD'));
end;
Running from within Lazarus on my Linux box I get -
Current = /home/dbannon/Pascal/ImportRTF
PWD = /home/dbannon/Pascal/ImportRTF
However, if I do the same thing on my Mac, I see -
Current = /
PWD = /Users/dbannon/bin/Lazarus/fixes_2/
The latter is, you guessed it, where my Lazarus install is. Not the directory the project files are saved in. But the really interesting one is the former, GetCurrentDirUTF8() returns root ?
If I run the app from the commandline, still on the Mac, the PWD entry gives a sensible result, but GetCurrentDirUTF8() still lies. Its a LazFileUtils function, should be OK on the Mac ?
Davo