|
From: John L. <jo...@jo...> - 2005-04-24 15:01:45
|
On Apr 24, 2005, at 3:33 AM, Tom Counsell wrote: > I have a feeling this is a really stupid question, but I really > can't see what to do, so I'd really appreciate your help: It's not so stupid. Xcode has some quirkiness in its interface that is *not* intuitive. > Using Xcode, how can I make it so that a ruby library is copied > into the application resources folder, but keep the folder > hierarchy so that the require statements work? You'll probably want to use a "Copy Files" build phase in Xcode. That will retain the hierarchy instead of flattening it. Here's how you might do it (note that I've tested this, but just with a regular ObjC Cocoa project, not with a Ruby project). 1. Add your Ruby library folder to the Xcode project. You could just drag it in from the Finder, or do Project > Add to Project... Check the "Copy items" checkbox if desired/necessary. Make sure you select the "Create Folder References" option; I couldn't get my test to work without this. 2. Open the Targets group, then the target for your application. Right-click on your application target and select Add > New Build Phase > New Copy Files Build Phase. (This might look slightly different; I'm using Xcode 2.0.) In the Info window, click the General tab and make sure Destination is set to Resources. (I suppose this could be set to whatever you want; see below) 3. In the Groups & Files pane, drag the group containing your Ruby library to the new Copy Files build phase under your application target. You should see the dot-with-horizontal-line marker; just make sure it's under and to the right of the Copy Files item. 4. Build your app! If you go to the Finder, select your built app, right-click, and select Show Package Contents, you should be able to navigate into your app's Resources folder, and find your Ruby library with hierarchy intact. You may need to modify $: ($LOAD_PATH) to point to the Resources folder; I haven't tried that part of it. You might also consider either using the existing Frameworks folder instead of Resources. I don't think it would make much different in the end, but is just an organizational thing. -- John Labovitz Macintosh support, research, and software development John Labovitz Consulting, LLC jo...@jo... | +1 503.949.3492 | www.johnlabovitz.com/ consulting |