In Delphi 12 you can write TPath.GetAppPath using System.IOUtils unit.
TPath.GetAppPath
System.IOUtils
It achieves the same result in exactly the same way, but the code looks more cross-platform and less like low-level hacking.