Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > [XCode] Building with non-source files

[XCode] Building with non-source files
Thread Tools
JordyD
Fresh-Faced Recruit
Join Date: Jul 2009
Status: Offline
Reply With Quote
Jul 22, 2009, 10:22 AM
 
I'm new to Mac development (previously using vim + gcc on Linux), and I've been trying out XCode, but one of my projects I started to test it out requires a .ttf file at runtime to be in the same directory. I've tried adding the file as a resource, but it doesn't run. Could anybody:
  1. Help me to get XCode to dump my file into the executable's directory or,
  2. Tell me where XCode puts the executable so I can dump it there myself

Thanks,
Jordy
     
larkost
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status: Offline
Reply With Quote
Jul 22, 2009, 05:45 PM
 
Are you producing something that create a bundle? That would be almost everything but command-line programs. If so, then just adding it to the project and making sure that it is included in your target (done by default), then it will be in your <bundle>/Contents/Resources folder. And NSBundle has a number of methods to help you get a path to these resources (including ones for localized resources).

If you are not creating a bundle then you are going to need to go in and play with your Target. You can get to it under the "Targets" item in the "Groups & Files" pane in the main document window in XCode. You will have to add a new Build Phase item to copy this.
     
JordyD  (op)
Fresh-Faced Recruit
Join Date: Jul 2009
Status: Offline
Reply With Quote
Jul 22, 2009, 08:13 PM
 
Thanks. This fixed my problem.

I ended up using the second approach. My project doesn't use Cocoa or Carbon, so I imagine I wouldn't be able to access NSBundle.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 08:00 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,