Results 1 to 10 of 10

Thread: Distributing Program with its own File Structure in MacOS Application Bundle

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Okay. The path thing is working. My game crashes because of another reason.

    All music and sound effects are played using an external commandline mp3 player (mpg123). This has several advantages, so I want to keep this.

    mpg123 is invoked by using a TProcess which I named "ExtProgram". Here's the code where it crashes ONLY when I start the game from the app bundle (it always works when started from command line!)

    Code:
    procedure PlayMusic(SoundFile: string);
    begin
      StopMusic;
      if blUseExternPlayer = True then
      begin
        ExtProgram.CommandLine := strExternPlayer + ' "' + CONST_DATADIR + 'music/' + Soundfile + '"';
    
        ExtProgram.Execute;
      end;
    end;
    I already have printed the complete ExtProgram.CommandLine in a debug file, to ensure that the path is correct -- it is. But still, the program crashes at the ExtProgram.Execute part.

    Why, and why only when started as App bundle? Aren't apps allowed to run other programs?


    Edit: A bit closer. Usually, I only passed the name of the extern binary (mpg123) to TProcess. Then the game crashed. When I passed the full path to the binary (i.e. /usr/local/bin/mpg123), the game did not crash -- but obviously mpg123 wasn't running either (because I didn't hear anything), although now both the paths to the binary and to the music file to play were full and correct.

    (By the way, I noticed that many examples in the www use TUTF8Process instead TProcess, and they also use a function "FindDefaultExecutablePath" to get the full path of a unix application on a system, but neither TUTF8Process nor FileUtil (where FindDefaultExecutablePath would be included) seem to be available on Mac).
    Last edited by Mario Donick; 10-01-2011 at 07:53 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •