"On relaunch, you attempt to go through all 5000 bookmarks and and start accessing the security scoped resources on them so you can show the files in your UI."
No, I only start accessing those resources when needed, so I don't access all 5000 at the launch at once, only when scrolling through for creating QL previews, update their filenames, etc. So it is pretty efficient.
"but I've heard of it (congrats)"
Thank you 🙂
"Seems impractical that a user would want to drag 5000 files there, but I guess it could happen (and since you are asking, I'm assuming it did)."
For me, it wasn't really about having 5,000 files in Yoink at once, but that over the course of the app's session, those 5,000 items could be reached altogether (over several days or weeks) and then the app would stop working (which, before I make the switch to bookmarks with the next update, is happening).
-
But again, I thought about it the wrong way. The actual culprit was not the amount of bookmarks or NSURLs added to the sandbox, but the dispatch_source for vnodes I create for each NSURL added so I can track if they're renamed or are moved to the Trash/deleted. I'll have to find a more efficient way for that.
Discarding the dispatch_sources and polling the NSURL's filePath (to see if it's in the Trash) would be an alternative, but I really, really do not want to do that.
I tried, instead of watching the files themselves if they're moved to the trash, watching the Trash and, if the Trash changes, see if it's one of Yoink's files that's in there.
It works, but only for the boot hard drive. It doesn't work for external disks' trashes, and I do not have permission to watch those inside the sandbox (I tried).
Generally speaking, it's a limitation only if 5,000 files are actually inside Yoink at one time. Then new files added fail. It's an edge-case, but it's still something I'd like to solve to be on the safe side.
Thank you for your feedback, Macho Man 😉