Creating a Package folder on Mac

I included “Mac” on the subject but I believe that Package folders are only possible on Mac OS.
I would like to create a folder and set it as a Package, so that it looked like a native file for my application, and I could place several files inside it.
I also believe that, once implemented, I can use it as a regular FolderItem, accessing the files inside it.
But I don’t know how to implement it.
I already did some searches on the subject and some people say that is it only needed to add an extension to the folder name. But that doesn’t seem to work.
So, what are the settings in the File Type Set Editor that I must set?
I also understand that I need to add something to the project that will be included in the Info.plist that is created inside the application package that is created when the application is built.
What is it that I need to add?
Any help would be greatly appreciated. Thank you.

A google search Creating a Package

from the Apple documentation. I never create packages, so it is up to you to read the docs there. Sorry

You are talking about a Bundle. Apple documentation is here:

https://developer.apple.com/documentation/bundleresources/information_property_list/bundle_configuration

It is a folder structure and the top level must be a Contents, within it there must be a Info.plist file. Some warnings about this though:

  • Only Finder will see the folder as a “single file”.
  • You cannot, for example, mail such an item.
  • If you copy it to another operating system it will be just viewed as a folder structure.

You might be better using something like a zip file to bind everything together. You can zip and unzip files using shell commands, or there are a number of third part libraries available to work with them. These are then cross platform. Microsoft Office, for example uses them for .xlsx .docx and pptx files (copy one and change the extension to zip and you can then unzip and see the contents).

If you are truly Mac only then a bundle could work.

See this in documentation : File Type Group Editor — Xojo documentation

Thank you everyone. It was a bit of reading and trial & error but I guess it is working now.

FWIW, it works even if there’s no “Contents” folder.

Fair enough.

The UTI is the most important thing, make sure it inherits from “com.apple.package” (or something very similar).

After some trial and error, that was what did the trick :slight_smile:

There is an article on xDev:

xDev Magazine 20-4 (July-August, 2022)

xDev 20.4 (Table of Contents)