Apple Bundle and Package Support
- Dominant language
- C++
- Stars
- 3.9k
- Forks
- 1k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 123
Description
- Bundles have a long history on Apple platforms.
- In a nutshell: A folder with a well-defined internal structure which is abstracted by the platform towards the user to appear like an atomic and traditional file while enabling developers to manage structure much more easily.
- Bundles need to retain data consistency as a whole.
- The are very common and any third-party app can also declare its own bundle type.
- Media creators are one of the main user groups on the Apple platforms and the apps used by them typically rely on bundles due to the sheer asset sizes (music production, video cutting, …).
- We definitely need to support bundles properly in our file provider extension.
We already have some code implemented which should take care of bundles which are reported differently than plain files but apparently is does not work as expected. It needs to be tested thoroughly.
## Tests
The following apps can be used to test synchronization of bundle formats:
- Any macOS app (bundle with `.app` suffix, usually immutable)
- Keynote presentations (not the atomic files but the old bundle format)
- Logic Pro projects
- Final Cut media libraries
Especially the document bundles need to be checked in context of editing. We need to ensure that the bundles retain data consistency. From user perspective, bundles are "atomic" things which appear like a file while in reality on lower layers (file system) they are a folder with structure.
## Technical Details
- Thinking about a Final Cut Pro media library as the example, a tiny changed file inside of it will cause the file provider framework to report the whole bundle as modified because they are considered as atomic units from user perspective and need to be updated and uploaded like that for consistency. This is unreasonable. I did a bit of amateur video editing some time ago which resulted in a dedicated 600 GB media library with proxy files and so on. 🤪 Like previously, the content of the created or modified bundle must be enumerated in depth and each item checked for changes individually. On the server side, we must update the modification date of the bundle itself accordingly, not just the tiny item inside of it.
- Symbolic links must be looked for in a bundle and if found, the whole bundle must be excluded from synchronization because a **partial synchronization corrupts** bundles. Already uploaded previous revisions must be left in place, if possible (which might result in a sync loop and messed up state).
## References
- Apple documentation archive about bundles for a general and conceptual overview: https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/Introduction/Introduction.html
- Foundation API for handling bundles: https://developer.apple.com/documentation/foundation/bundle
- Wikipedia article: https://en.wikipedia.org/wiki/Bundle_(macOS)
- [Item+Create.swift](https://github.com/nextcloud/desktop/blob/master/shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Item/Item%2BCreate.swift) - already has some code handling bundles.
- [Item+Modify.swift](https://github.com/nextcloud/desktop/blob/master/shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Item/Item%2BModify.swift) - already has some code handling bundles.
Contributor guide
Assessment
This issue has not been assessed yet.