29

Whenever I use the Gethomepath function of Delphi I keep getting Shell Script Invocation Error.

Was this function replaced by a newer one?

Marc
  • 16,170
  • 20
  • 76
  • 119
Jan Windemuth
  • 486
  • 3
  • 13
  • 1
    I can't help you since I don't know MacOS, but I'll leave here what is being called from Delphi `GetHomePath` function `string(getenv(PAnsiChar(UTF8String('HOME'))))`. It could be helpful for those who don't have Delphi but know about MacOS development. – TLama Jun 05 '12 at 13:41
  • I just realised there was Freepascal 2.4.4 installed on the Mac... I'll upgrade it to 2.6 tomorrow. Hoping this will help. – Jan Windemuth Jun 05 '12 at 14:54
  • Freepascal 2.6 doesn't solve the problem. Any ideas ? – Jan Windemuth Jun 06 '12 at 06:09
  • 3
    I finally found a workaround for this: http://blogs.embarcadero.com/ao/2011/10/04/39144#comment-7998 So "S := ExtractFilePath(paramstr(0)); S := Copy(S, 1, length(S) - 14);" gets the job done. – Jan Windemuth Jun 11 '12 at 13:52
  • note that on Stackoverflow you can post answers to your own questions, and accept them – mjn Nov 02 '12 at 15:25

1 Answers1

1

I finally found a workaround for this: blogs.embarcadero.com/ao/2011/10/04/39144#comment-7998

So "S := ExtractFilePath(paramstr(0)); S := Copy(S, 1, length(S) - 14);" gets the job done.

Note that the length of S depends on your application title.

Jan Windemuth
  • 486
  • 3
  • 13