I'm developing a desktop application which saves its projects to disk. Projects contain multiple files, like json
and jpg
etc.
Current solution: zipped file
I'm "zipping" them all together into a single file. Example:
filename.project <- compressed zip
manifest.json <- compressed contents
file1.jpg
Ideal solution: uncompressed folder
I'm wondering if it's possible to output the data, uncompressed, to a folder instead, and somehow configure my OS to treat that folder as a single file? Example:
filename.project <- folder, but it gets treated like a file
manifest.json <- uncompressed contents
file1.jpg
Definition of "Treated as a single file":
- Finder shows a custom icon
- Double-clicking opens the file association
- "Open" dialogs can select this file
Other examples
On my Mac, there are 2 examples where I see this happening:
– All apps appear as .app
files, but internally are folders that I can explore via Terminal
– 1Password stores its password store in a .agilekeychain
folder, which syncs to Dropbox as a folder, but appears in Finder as a single file.
Best Answer
Apple Developer info says yes, you can definitely make your own package or bundle. Seems as if you want a package.
Package vs. bundle is discussed here.
Basically - register your package with the system, so that folders with the extension are displayed as a package rather than as a folder (application info.plist must appropriately set key
LSTypeIsPackage
for each of the package filetypes you need to create). Then set your app to automatically (usingNSFileWrapper
) or manually create the package itself on save.