How to make Application bundle from Executable? (Mac)
Gan via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Feb 20 11:03:14 PST 2015
On Friday, 20 February 2015 at 17:28:48 UTC, Nicholas Wilson
wrote:
> On Friday, 20 February 2015 at 06:19:29 UTC, Gan wrote:
>> On Friday, 20 February 2015 at 06:10:51 UTC, Nicholas Wilson
>> wrote:
>>> On Friday, 20 February 2015 at 03:26:47 UTC, Gan wrote:
>>>> Also I can't get my application to load images that I place
>>>> in the Resources folder(or any folder in the bundle for that
>>>> matter).
>>> I suggest to have a look at the projects generated by SFML
>>> regarding locating the resources in C++/ObjC and translate
>>> them to C/ObjC/D.
>>> As for code (i.e frameworks and .dylibs) i don't know as
>>> shared libraries are still a murky area for D. Probably just
>>> better to stick to static libs.
>>>> Is there an official way to turn a D executable into a Mac
>>>> Application Bundle?
>>> Dunno
>>>
>>> Good luck!
>>
>> Frameworks aren't an issue, I put them into the Frameworks
>> folder in my hand made bundle and they load fine.
>> When running the executable, it loads the image when it's in
>> the same folder but when running the executable through the
>> bundle, it doesn't find the image anywhere.
>
> are you loading using relative or absolute addresses (
> ../../Resources/img.png or $BUNDLE_ROOT/Resources/img.png ) ?
> also check the cwd when launched from the executable vs, the
> bundle. Also does Console give any output?
I fixed it by using:
string path = thisExePath();
int index = to!int(path.lastIndexOf("/"));
if (!GameFont.loadFromFile(path[0 .. index]~"/vertiup2.ttf")) {
writeln("Font failed to load");
}
Now my hand made bundle works fine and loads resources from
inside the bundle.
More information about the Digitalmars-d-learn
mailing list