This is mnoGoSearch's cache of https://lists.gambas-basic.org/archive/user/2024-03/0000319.html. It is a snapshot of the page as it appeared during last crawling. The current page could have changed in the meantime.

Last modified: Sun, 24 Mar 2024, 04:21:02 CET    Size: 6453
Re: How to embedded file/sound into executable?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to embedded file/sound into executable?

  • Subject: Re: How to embedded file/sound into executable?
  • From: BB <adamnt42@xxxxxxxxx>
  • Date: Sun, 24 Mar 2024 10:20:48 +1030
  • To: gambas Mailing List <user@xxxxxxxxxxxxxxxxxxxxxx>


On 24/3/24 10:17 am, BB wrote:

On 24/3/24 7:41 am, roberto.premoli@xxxxxxxxxx wrote:
Il 23.03.2024 21:27 T Lee Davidson ha scritto:

On 3/23/24 15:45, roberto.premoli@xxxxxxxxxx [1]wrote:

QUESTION: Is possible to "embedded" the din-din.wav file inside the
executable when i compile the project and play it when needed? this
will make the wav file part of the executable, so it will be always
available.

Yes, just place a copy of the WAV file in the top-level directory of your
project. You see it under the Data directory of the
project after a Project -> Refresh. Then just call your Exec thus:

Exec ["aplay", Application.Path &/ "din-din.wav"] Wait

-- Lee ---

hello,
it works when i am in gambas IDE.
then I compile and install the .deb packege.
then I start the program from command line, it pop up the window and does it works. but when the event is triggered,  i have the follow feedback in command line:

/usr/bin-din-ding.wav: file or directory  does not exist.

so gambas expect to find  te sound as external file, not "inside" the executable.

Roberto


Try using relative paths, as explained in the "File & Directory Paths" page.

b

Ah, I just realised. Because you are passing the file path to an external program (which can't see inside the executable) you need to :

on startup, copy the file from inside the executable to a Temp directory

then you can refer to that file in your Exec call.

b


Follow-Ups:
Re: How to embedded file/sound into executable?Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
Re: How to embedded file/sound into executable?T Lee Davidson <t.lee.davidson@xxxxxxxxx>
References:
How to embedded file/sound into executable?roberto.premoli@xxxxxxxxxx
Re: How to embedded file/sound into executable?T Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: How to embedded file/sound into executable?roberto.premoli@xxxxxxxxxx
Re: How to embedded file/sound into executable?BB <adamnt42@xxxxxxxxx>