tags:

views:

116

answers:

1

I have an AliasRecord creating using the Alias Manager function FSNewAlias(fromFSRef, targetFSRef, &aliasRecordHandle). My understanding is that the resulting alias record will contain information for a relative path search (relative to fromFSRef). Because my users are on networked home directories and mobile accounts, these aliases do not appear to persist the location of a file in the user's home directory between the networked and mobile home directories because they are on different volumes. If the original fromFSRef corresponded to /Network/.../Users/user/Desktop in the network account, I would like to be able to resolve the alias using FSResolveAlias(newFromFSRef, aliasRecordHandle, &targetFSRef, &changed) with newFSRef corresponding to /Users/user/Desktop (i.e. the mobile account). Is this possible?

The solution I've resorted to is to persist the alias record and the relative path. I use the relative path to create a new alias if alias resolution fails.

A: 

It appears that the solution proposed in the question—persisting both the alias record and a relative path is the only option. If alias resolution fails, we try using the relative path (along with an application or user-defined root) to find the file. If this succeeds, we update the alias record with the new path. Otherwise, we fall back to asking the user to find the "lost" file.

Barry Wark