• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Open a file package
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Open a file package


  • Subject: Re: Open a file package
  • From: Charles Srstka <email@hidden>
  • Date: Sat, 9 Oct 2004 12:34:57 -0500

Well, since a file package is really nothing more than just a folder that looks like a file in the Finder, you could just:

NSMutableArray *array = [NSMutableArray arrayWithContentsOfFile:@"/myFile/myArray.plist"];
NSImage *image = [[[NSImage alloc] initWithContentsOfFile:@"/myFile/myImage.tiff"] autorelease];

and then do whatever you want with the array and image.

Charles

On Oct 9, 2004, at 5:33 AM, Peter Karlsson wrote:

I think I got it now but I'm not sure.

If I want to open a package I do the following:

// package folder
NSFileWrapper *directory = [[NSFileWrapper alloc] initWithPath:@"/myFile"];

// one of the files inside the package (a serialized property list)
NSFileWrapper *file = [[directory fileWrappers] objectForKey:@"Property
List"];

// read the file to NSData
NSData *fileContent = [file regularFileContents];

// deserialize property list
myMutableArray = [NSDeserializer deserializePropertyListFromData:
fileContent mutableContainers: NO];

Is this the right way?

Peter


Ursprungligt meddelande

Dear list!

I have saved a file package with 2 files in it. One of the files is a
serialized property list, the other file a .tif image. How do I open the
package and read the 2 files back to my NSMutableArray and NSImage?

Best regards Peter

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden

This email sent to email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >RE: Open a file package (From: "Peter Karlsson" <email@hidden>)

  • Prev by Date: Re: Getting Data out of NSImages
  • Next by Date: Re: Getting Data out of NSImages
  • Previous by thread: RE: Open a file package
  • Next by thread: Something akin to Apple's TextLinks for NSTextFieldCell
  • Index(es):
    • Date
    • Thread