• 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: Preserving knowledge of renamed/moved directory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preserving knowledge of renamed/moved directory?


  • Subject: Re: Preserving knowledge of renamed/moved directory?
  • From: Charles Srstka <email@hidden>
  • Date: Mon, 28 Nov 2016 19:30:33 -0600

> On Nov 28, 2016, at 7:06 PM, Rick Mann <email@hidden> wrote:
>
> Back in the days before URLs, I could have an FSRef to a directory, and no matter where I moved that directory what I named it, the FSRef was still valid, and I could still read/write to it.
>
> Now that everything is URL based, if a thread changes the name of a directory, or moves it, another thread's URL pointing to that directory (or inside it) becomes invalid, right?
>
> Is there any way for this to not be the case? That is, for a URL to a directory or subdirectory or item within to stay valid even if the path to it changes?

I’ve got good news and bad news.

The good news: Yes, there is a way. Just call .fileReferenceURL on an NSURL in Objective-C, and you’ll get something that works just like an FSRef.

The bad news: This is currently broken in Swift, as of Swift 3, where all file reference URLs will get silently and unceremoniously converted back to path-based ones at the bridge. This can be worked around via an Objective-C wrapper, though.

Charles


_______________________________________________

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: Preserving knowledge of renamed/moved directory?
      • From: Rick Mann <email@hidden>
    • Re: Preserving knowledge of renamed/moved directory?
      • From: Quincey Morris <email@hidden>
References: 
 >Preserving knowledge of renamed/moved directory? (From: Rick Mann <email@hidden>)

  • Prev by Date: Preserving knowledge of renamed/moved directory?
  • Next by Date: Re: Preserving knowledge of renamed/moved directory?
  • Previous by thread: Preserving knowledge of renamed/moved directory?
  • Next by thread: Re: Preserving knowledge of renamed/moved directory?
  • Index(es):
    • Date
    • Thread