A package is just a directory, apparently, but somehow Finder and Path Finder know it's a package.
How is this indicated in the file system? I've tried a few changes to a directory to make it a package but to no avail.
To register a document as a package, the developer of DayOne would have had to modify the document type information in the DayOne app's information property list (Info.plist) file.
A package is a file system directory used by macOS and iOS. It's basically a directory that will appear as a single file, but which may in fact contain a preserved state of files and folders. So, a folder could have a number of subfolders and many files, but as a package it will be displayed to users like a single file. For example, in macOS the Finder will see a package as a single file to avoid users mucking around with the actual contents. However, users can view the contents through various methods such as right-clicking on the package and selecting Show Package Contents from the context menu.
Apple's Bundle Programming Guide, available on their Developer site, has a whole section on Document Packages. Below are some relevant quotes:
To register a document as a package, you must modify the document type information in your application’s information property list (
Info.plist) file. The
CFBundleDocumentTypeskey stores information about the document types your application supports. For each document package type, include the
LSTypeIsPackagekey with an appropriate value. The presence of this key tells the Finder and Launch Services to treat directories with the given file extension as a package. For more information about
Info.plistkeys, see Information Property List Key Reference.
Document packages should always have an extension to identify them—even though that extension may be hidden by the user. The extension allows the Finder to identify your document directory and treat it as a package. You should never associate a document package with a MIME type or 4-byte OS type.
Source: Bundle Programming Guide
On the off-chance you can't access the document, let me know and I'll include some additional quotes from the page.
As I have made a document-based application for macOS, I may help you understand a bit. Although @Monomeeth's answer is right, dealing with GUI is a lot better than
Info.plist. People usually use another path. They subclass
NSDocment, which provides the basis for file/bundle saving and loading. Then, people go to Xcode and under the "General" tab, define a document type, then go to "Exported UTIs" and export an UTI that conforms to
com.apple.package. They read in with the
NSFileWrapper class. This way, people won't have to do some tedious work with stuff like
If you want to create a bundle, check this answer. Simply create an empty macOS app and edit the "Exported UTIs" sections to taste.