Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
- Subject: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
- From: Jean Suisse <email@hidden>
- Date: Sat, 22 Oct 2016 20:26:34 +0200
Dear Quincey,
Thank you for your reply. I have posted the code including the line below. It got deleted by mistake.
Though it looks like I am trying to access "/.DocumentRevisions-V100/“, it is not what I am trying to achieve.
At some point my app needs to enumerate user-selected directories. The issue is I get a crash when directories such as "/.DocumentRevisions-V100/“ are present.
I cannon reasonably maintain a list of “don’t enumerate” directories.
Thus, my question is not “how can I enumerate "/.DocumentRevisions-V100/“” but how can I not crash when encountering it ?
Best regards,
Jean
let directoryURL = URL(fileURLWithPath: "/.DocumentRevisions-V100/")
let manager = FileManager.default
let keys = [URLResourceKey.nameKey, URLResourceKey.isDirectoryKey, URLResourceKey.isSymbolicLinkKey,
URLResourceKey.isVolumeKey, URLResourceKey.isPackageKey,URLResourceKey.isSystemImmutableKey,
URLResourceKey.isUserImmutableKey, URLResourceKey.isHiddenKey, URLResourceKey.volumeURLKey,
URLResourceKey.fileSizeKey, URLResourceKey.fileAllocatedSizeKey, URLResourceKey.totalFileSizeKey,
URLResourceKey.totalFileAllocatedSizeKey, URLResourceKey.contentModificationDateKey,
URLResourceKey.isAliasFileKey, URLResourceKey.creationDateKey]
let enumerator = manager.enumerator(at: directoryURL, includingPropertiesForKeys: keys, options: [.skipsSubdirectoryDescendants])
{
url, error -> Bool in
print(error.localizedDescription)
return true
}
// this will
while let file = enumerator?.nextObject() as? URL
{
// ...
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden