• 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
Weird issue with BDAlias/FSRefs and the case of filesystem paths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird issue with BDAlias/FSRefs and the case of filesystem paths


  • Subject: Weird issue with BDAlias/FSRefs and the case of filesystem paths
  • From: Rob Keniger <email@hidden>
  • Date: Tue, 5 Jan 2010 17:01:02 +1000

Hi everyone,

I'm using the BDAlias wrapper (http://github.com/rentzsch/bdalias) for handling alias records so that my app manages files better when they're moved or renamed.

Things were working fine but recently, for no apparent reason, any alias that points to a file in the Users folder returns a lowercase "users" filename for the Users folder rather than the normal "Users".

This means that my paths look like this:

/users/rob/some/file.html

rather than this:

/Users/rob/some/file.html

If I use any of the Cocoa methods to select a file such as NSOpenPanel, or just print NSHomeDirectory(), I get the correct result, "Users".

In the Finder and when using Terminal, the folder is named "Users". From what I can tell there are no extended attributes on the Users folder, running "xattr -l -v /Users" returns nothing.

I've looked at the BDAlias code and it's pretty straightforward, it is just getting a CFURLRef from the path and then grabbing the FSRef from the URL, something like this:

FSRef *outRef;
CFURLRef	tempURL = NULL;
Boolean	gotRef = false;
tempURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, inPath, kCFURLPOSIXPathStyle, false);
if (tempURL == NULL)
        return fnfErr;
gotRef = CFURLGetFSRef(tempURL, outRef);

When the BDAlias object is asked for its path it does the reverse, and gets the path from the FSRef via a CFURL:

CFURLCreateFromFSRef(kCFAllocatorDefault, inRef);
if (tempURL == NULL)
   return NULL;
CFStringRef result = CFURLCopyFileSystemPath(tempURL, kCFURLPOSIXPathStyle);

This all seems fine, and the only things I can think of is that there is some weird bug in CoreFoundation that's causing this or that my drive is corrupted in some weird fashion, although Disk Utility reports no problems.

Interestingly, on my system other apps such as BBEdit and Coda also exhibit this behaviour. In BBEdit for example, if I choose Edit > Insert > File/Folder Paths then I get "/users/rob/some/file.html". I assume that's because it's also using FSRefs internally.

I don't understand what could be happening here, does anyone have any clues? I've never seen anything like this.

--
Rob Keniger



_______________________________________________

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: Weird issue with BDAlias/FSRefs and the case of filesystem paths
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: NSViewController view swapping where to put the buttons at?
  • Next by Date: Getting warning when saving merged MOC
  • Previous by thread: Is it possible to change the color of selected columns in NSTableView?
  • Next by thread: Re: Weird issue with BDAlias/FSRefs and the case of filesystem paths
  • Index(es):
    • Date
    • Thread