• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
      • From: Jens Alfke <email@hidden>
References: 
 >EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Jean Suisse <email@hidden>)
 >Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
  • Next by Date: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
  • Previous by thread: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
  • Next by thread: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
  • Index(es):
    • Date
    • Thread