How to link openframeworks application in xcode (relative resource binding?)

Trying to get openframeworks to create my application so that I can open it from anywhere, and it will load the desired images from the application resource folder.

I believe this is a relative relationship?

I did this before on earlier xcode and oF 61.

To do this, I dragged the desired images to the project file on the left and added it to the executable target using the “build phase” → “copy files”.

I tried all kinds of methods from SetDataPathRoot (), which solved the problem for the last time, does not work for me this time.

Any ideas / help would be appreciated!

thank

+3
source share
3 answers

xCode, /bin/data , :

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";

, .

oF:

ofSetDataPathRoot("../Resources/data/");
+8

ofSetDataPathRoot() . , ?

ToDataPath() , Terminal cd .app, . .app, , myApp.app/Contents/MacOS/myApp, myApp.app/Contents/Resources, ofToDataPath( "texture.png" ) - ../Resources/texture.png.

(myApp.app/Contents/MacOS ), getcwd(), man getcwd .

0

OF now sets the root path for the data and makes internal calls ofToDataPath()by default. Which version are you using?

Have you looked at the contents of the product package to make sure your resources receive copies in the correct build phase?

0
source

Source: https://habr.com/ru/post/1789659/


All Articles