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

Re: How to embedded file/sound into executable?



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>