Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When is a File not a File?



Thank you Greg, Rob and Werner,

Following Gregs response I'd found out about Document Bundles and NSBundle just as Rob posted his example code (for a mixture of Keynote and Pages and no doubt other documents too :-) ). Thanks for that.

I'll investigate Werners solution too which is great because its pure Java. I just might need to re-evaluate a previous decision to use AWT FileChooser instead of JFileChooser (rest of my interface is Swing).

Thanks for you help.



On 10 Jun 2005, at 19:08, Robert MacGregor wrote:


On 10-Jun-05, at 1:15 PM, Ian Cheyne wrote:


Answer: When its actually a Directory.


In this case when it's a bundle. The easiest course is to use NSBundle to access the bundle. For a Keynote bundle called "FeatureSummary.key":



import com.apple.cocoa.foundation.*; import com.apple.cocoa.application.*;


NSBundle keynoteBundle = NSBundle.bundleWithPath ("FeatureSummary.pages");


System.out.println("Keynote bundle is "+keynoteBundle);

NSDictionary info = keynoteBundle.infoDictionary();
System.out.println("Info is "+ info);

NSArray resources = keynoteBundle.pathsForResources(null, keynoteBundle.bundlePath());
System.out.println("Bundle resources :"+ resources);





Note: NSBundle.bundleWithPath() will return null if the path-string isn't a bundle.




NSBundle
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ Java/Classes/NSBundle.html#//apple_ref/doc/uid/20000322-BCIBBIGC



Rob



_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >When is a File not a File? (From: Ian Cheyne <email@hidden>)
 >Re: When is a File not a File? (From: Robert MacGregor <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.