getattrlistbulk lists files with underscore prefix on exFAT

It seems that on exFAT macOS creates a file with an underscore prefix for each file to hold some metadata (I guess). When enumerating a directory with FileManager, these files are not listed, but they are when using getattrlistbulk. Is there a way to mimick the FileManager behaviour? Unfortunately I have to resort to getattrlistbulk because FileManager doesn't allow me to efficiently get a file's inode number.
Answered by DTS Engineer in 628349022
Are these AppleDouble files? You can recognise them two ways:
  • If the file is called foo, the corresponding AppleDouble file is ._foo.

  • They have a leading magic number of 00 05 16 07.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer
Are these AppleDouble files? You can recognise them two ways:
  • If the file is called foo, the corresponding AppleDouble file is ._foo.

  • They have a leading magic number of 00 05 16 07.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thanks, that seems to be the case. Is there a more efficient way of checking that a file is an AppleDouble file other than testing if a file exists with the same name but without the ._ prefix or check the first bytes against that magic number? During my test I noticed that the dot underscore file seems to be enumerated by getattrlistbulk immediately after the original file: is this always guaranteed and is there a documentation somewhere that explains this in more detail? Any idea how FileManager does it?

is this always guaranteed … ?

Definitely not.

Any idea how FileManager does it?

I don’t think there’s any magic here. FileManager detects AppleDouble files in the obvious way (looks for the ._ prefix and then matches based on name).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
I'm wondering what I have to do in order to make this work on iOS as well. In the bridging header I have #include <sys/vnode.h> which works fine when building for macOS, but for iOS I get the error 'sys/vnode.h' file not found. Do I have to include some framework or library in the iOS target's Build Phases?
Sorry, wrong thread.
getattrlistbulk lists files with underscore prefix on exFAT
 
 
Q