Thread overview
How to make Application bundle from Executable? (Mac)
Feb 20, 2015
Gan
Feb 20, 2015
Jeremy DeHaan
Feb 20, 2015
Nicholas Wilson
Feb 20, 2015
Gan
Feb 20, 2015
Israel
Feb 20, 2015
Nicholas Wilson
Feb 20, 2015
Gan
February 20, 2015
I managed to copy an application bundle and change stuff inside it to run my executable, but it was very manual and kinda hackish. 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).


Is there an official way to turn a D executable into a Mac Application Bundle?
February 20, 2015
On Friday, 20 February 2015 at 03:26:47 UTC, Gan wrote:
> I managed to copy an application bundle and change stuff inside it to run my executable, but it was very manual and kinda hackish. 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).
>
>
> Is there an official way to turn a D executable into a Mac Application Bundle?

I don't have an answer, but I too am interested in hearing what others have to say about this.
February 20, 2015
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!
February 20, 2015
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.
February 20, 2015
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.

It seems OSX is doing some weird stuff then...
February 20, 2015
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?
February 20, 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.