www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to make Application bundle from Executable? (Mac)

reply "Gan" <avisaria me.com> writes:
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?
Feb 19 2015
next sibling parent "Jeremy DeHaan" <Dehaan.jeremiah gmail.com> writes:
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.
Feb 19 2015
prev sibling parent reply "Nicholas Wilson" <iamthewilsonator hotmail.com> writes:
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!
Feb 19 2015
parent reply "Gan" <avisaria me.com> writes:
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.
Feb 19 2015
next sibling parent "Israel" <Tl12000 live.com> writes:
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...
Feb 20 2015
prev sibling parent reply "Nicholas Wilson" <iamthewilsonator hotmail.com> writes:
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?
Feb 20 2015
parent "Gan" <avisaria me.com> writes:
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.
Feb 20 2015