• 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: How to discover the volume id to use in a File Reference URL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to discover the volume id to use in a File Reference URL


  • Subject: Re: How to discover the volume id to use in a File Reference URL
  • From: Ken Thomases <email@hidden>
  • Date: Tue, 24 Sep 2013 03:04:33 -0500

On Sep 23, 2013, at 11:14 AM, Ben Staveley-Taylor wrote:

> Does anyone know how to get the volume ID number to use in a reference URL?
>
> I am working with file reference URLs as returned by - (NSURL *)fileReferenceURL. These have this textual form:
>
>  file:///.file/id=<volume_id>.<file_id>/
>  e.g. file:///.file/id=6571367.2773272/
>
> I want to compose a reference URL for a file whose file_id I know.

Why would you want to do that?

In any case, it's not supported.  From "NSURL and CFURL Release Notes: File Reference URLs" <https://developer.apple.com/library/mac/releasenotes/Cocoa/RN-NSURL/#//apple_ref/doc/uid/TP40007753-CH1-DontLinkElementID_2>:

"The syntax of a file reference URL should be considered opaque, and may change from release to release."


> I know the textual path of the volume it is on (e.g "/Volumes/Bob"). I can't figure out how to get the volume ID to use from the volume name or path

I hesitate to suggest this, but have you tried creating an NSURL for a file path on the volume and then asking it for its file-reference-URL form?


> So far I have tried
>
> 	NSURL *vol = [NSURL urlWithString:@"/Volumes/Bob"];
> 	id volId;
>
> 	[vol getResourceValue:&volId
> 		forKey: NSURLVolumeIdentifierKey
> 		error:&err];
>
> But can't see how to use the opaque volId object result;

It's opaque by design.  It's only useful for comparing to another volume's identifier with -isEqual:.  That's it.  It's for when you have two URL objects and you want to determine if they're on the same volume.

-Ken


_______________________________________________

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: How to discover the volume id to use in a File Reference URL
      • From: Ben Staveley-Taylor <email@hidden>
References: 
 >How to discover the volume id to use in a File Reference URL (From: Ben Staveley-Taylor <email@hidden>)

  • Prev by Date: How is one supposed to use a UIPageViewController in a storyboard?
  • Next by Date: Re: How to discover the volume id to use in a File Reference URL
  • Previous by thread: How to discover the volume id to use in a File Reference URL
  • Next by thread: Re: How to discover the volume id to use in a File Reference URL
  • Index(es):
    • Date
    • Thread