[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Aliases and #_OpenResFile



 
Rich Lynch writes in a message dated Fri, 17 Apr 1992 13:56:06 -0600:

> I have an alias in one folder (it has the same file-name as
> the original). I thought I could use "ccl;" and "home;" in
> both a development and a stand-alone application and have
> Finder aliases track down the original. 
> 
> The development and stand-alone application reside in
> different folders and the one large resource file they both
> need is stored with the stand-alone app. The alias is in the
> development folder. 
> 
> When I pass the alias to #_OpenResFile, I get a valid refnum
> and all, but the resources are definitely not available. I've
> tried calling #_UseResFile, just for fun, and that had no
> effect. 

You're passing the _name_ of the alias to #_OpenResFile. The alias file is
itself a resource file containing a resource of type 'alis', thus the
#_OpenResFile
call succeeds.

> I can make it work using the original file, so I'm relatively
> certain I'm using the trap calls and such-like properly. 

You need to "resolve" the alias to find the original file. Take a look at
ResolveAlias,
as described in IM VI Chapter 27.

> I can fix this myself with a little juggling of pathnames,
> but I thought y'all might wanna look at it. It could easily
> be a Finder error, and I got no clue who to tell if so. 

You're seeing correct behavior. If you were to open your file using a standard
file dialog, the alias resolution would be done for you (which is why old
applications
don't break when faced with aliases). Because you're opening the file "by
name",
you have to deal with the possibility that it may be an alias file.

Dave
--  
 --- Through FidoNet gateway node 1:16/390
David.Lamkins@p14.f640.n101.z1.fidonet.org