Hi to you all,
As a first project to get to learn oF I made a simple project where I load 12 short videoclips and trigger them by hitting a key on my keyboard.
At the moment all the videofiles are located in bin/data/ (as default) and it works just fine. However; I want to share my project and found out that after I compiled the project I still have to send the folder(s) bin/data/ along with my .app (I work on a Mac) because otherwise the videos are missing.
So I was wondering if it is possible to “embed” my moviefiles into my .app?
Something like “MyProject.app/Contents/videoclips/clip1.mov”
Is that possible? Would be a major letdown for me if all assets have to be located externally.
Thanks in advance!
try dragging all of your assets into your xcode project. you can place them anywhere, but I usually create a “data” folder in the project tree and add assets there. Then before you load anything in your code, call ofDisableDataPath(); (e.g. as the first line in setup). Then all assets will be loaded from your resource bundle.
Thanks for the fast reply.
I think I’m doing something wrong though… this is what it looks like after your advice:
I’m not really sure about the following; When I add my files I get this dialog:
What should be the settings to get this right? Or am I doing something else wrong?
Hi, this is where it gets a little bit confusing.
Basically the yellow folders in the xcode project tree are there for only organizational purposes. they are not created in the app bundle. So when loading do not use “clips/…” just use the name directly.
the settings you use when you get the add file dialog is correct.
if you were to drag the entire ‘clips’ folder form your harddisk into your project tree (instead of dragging the files one by one), and instead of “Recursively create groups for any folders” you chose “Create folder references for any added folders”, then the clips folder would be created blue instead of yellow. that means it is a ‘folder reference’ instead of group. Then the folder will be created inside the app bundle and you will have to load with “clips/…”. One advantage of the folder system is, that the files inside it will auto-update. So if you add a file to the clips folder in your harddisk, it will automatically appear in your xcode project tree.
Very clear description, thanks However, I tried both (and various other) ways but I still can’t get it to work… This error keeps coming back:
OF_ERROR: FSPathMakeRef failed -43
OF_ERROR: Error loading movie
My .app remains the same size as it used to be and it seems my files aren’t getting included in the bundle. Shouldn’t my files be shown in the index when I click on my Build Target in the sidebar?