I have a collection of .pcap files in iCloud Drive that I need to parse using low level C APIs.
To open the file, I need to use fopen(). However, it appears that when the file hasn't been downloaded/sync'ed, meaning it's in iCloud but not yet on disk, then fopen() fails with "No such file or directory."
I thought fetching the file from iCloud would be transparent to any file system APIs, including low-level C APIs, when trying to open the file, but that doesn't seem to be the case.
If I use NSOpenPanel first to choose the file from iCloud Drive and then pass the path to fopen(), it works because NSOpenPanel triggers the file's download. But, in the scenario I'm testing, I'm trying to drag and drop the file from Finder, retrieving the path to the file from the pasteboard, and passing it to fopen(), but that doesn't work unless the file has already been sync'ed/downloaded from iCloud.
What would be the right way to ensure that fopen() works with files stored in iCloud Drive?
Thanks,
Adrian
To open the file, I need to use fopen(). However, it appears that when the file hasn't been downloaded/sync'ed, meaning it's in iCloud but not yet on disk, then fopen() fails with "No such file or directory."
I thought fetching the file from iCloud would be transparent to any file system APIs, including low-level C APIs, when trying to open the file, but that doesn't seem to be the case.
If I use NSOpenPanel first to choose the file from iCloud Drive and then pass the path to fopen(), it works because NSOpenPanel triggers the file's download. But, in the scenario I'm testing, I'm trying to drag and drop the file from Finder, retrieving the path to the file from the pasteboard, and passing it to fopen(), but that doesn't work unless the file has already been sync'ed/downloaded from iCloud.
What would be the right way to ensure that fopen() works with files stored in iCloud Drive?
Thanks,
Adrian
What you need to do here is a coordinated read per NSFileCoordinator.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"