Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bundle an openframeworks application in xcode (relative resource linking?)

An trying to get openframeworks to build me my application so that i can open it from anywhere and it will load the needed images from within the apps Resources folder.

I believe this is relative linking?

I have done it before, on an older xcode and oF 61.

To do this i dragged the needed images into the project file on the left and added it to the executable target, with in a 'build phase' -> 'copy files'.

Been trying all sorts of methods, ofSetDataPathRoot() which solved the problem last time isnt working for me this time.

Any ideas/help would be appreciated!

Thanks

like image 306
aKiwi Avatar asked Jan 21 '23 14:01

aKiwi


1 Answers

First you need to tell xCode to copy your /bin/data directory into your application bundle by adding a build phase:

1. Click on your project in the Project Navigator
2. Select "Build Phases"
3. Toggle open the "Run Script" section and paste in the following:
cp -r bin/data "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources";

Then tell your app where to find the data folder relative to itself within the bundle.

Inside the setup method of your oF app:

ofSetDataPathRoot("../Resources/data/");
like image 98
braitsch Avatar answered Jan 31 '23 01:01

braitsch