iosnsfilewrapper

Is an NSFileWrapper package similar to a Mac OS X Package (pkg)?


In numerous places, the Apple documentation talks about packages of files (e.g. for iCloud) created by NSFileWrapper. Is this is any way similar to the .pkg format used to hide a folder as a single file on the OS X platform?

I have an app with multiple text files that I'd like to be able to let the user backup. I've used NSFileWrapper to create a single 'file' that does this. I had assumed that this was similar to a .pkg file on OS X, but despite then bringing the file into OS X (via email) I have no way of opening it - despite renaming files, etc.

So, is the NSFileWrapper 'package' completely different to the OS X 'package'?

Thanks, Richard


Solution

  • No. One works on the filesystem level, while the other is a bunch of files compressed together with a specirfic set of unpacking instructions

    NSFileWrapper, From the link you mentioned:

    A file wrapper is a runtime representation of a file-system node, which is either a directory, a regular file, or a symbolic link.

    While a .pkg would look something like:

    A xar-based format used on a number of platforms to install files.

    Wikipedia, (un)surprisingly enough, has a decent overview of what exactly a .pkg is.