How to determine a volume supports resolving bookmarks to renamed or moved files?
Asked Answered
M

1

3

- bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error:

Documentation states:

This method returns bookmark data that can later be resolved into a URL object for a file even if the user moves or renames it (if the volume format on which the file resides supports doing so).

My question is, how can I query if a volume supports this feature?

From trial and error it seems only (internal?) hard drives support it, but I am looking for some kind of sure test like a NSURLVolumeSupports???Key.

NSURLVolumeSupportsPersistentIDsKey looks like a good candidate, but I failed to find any docs or google-info about it. Any hints?

Mule answered 1/11, 2015 at 15:49 Comment(0)
S
0

It definitely sounds like the NSURLVolumeSupportsPersistentIDsKey would apply.

Following the hints in this forum thread here (archived version here), the documentation for the VOL_CAP_FMT_PERSISTENTOBJECTIDS volume capability flag (from man getattrlist(2)) says:

If this bit is set the volume format supports persistent object identifiers and can look up file system objects by their IDs. See ATTR_CMN_OBJPERMANENTID for details about how to obtain these identifiers.

and the common attribute ATTR_CMN_OBJPERMANENTID documentation says

An fsobj_id_t structure that uniquely and persistently identifies the file system object within its volume; persistence implies that this attribute is unaffected by mount/unmount operations on the volume. Some file systems can not return this attribute when the volume is mounted read-only and will fail the request with error EROFS. (e.g. original HFS modifies on disk structures to generate persistent identifiers, and hence cannot do so if the volume is mounted read only.)

Sunburn answered 26/7, 2022 at 15:50 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.