[comp.sys.mac.programmer] Sys7.0 aliases and MPW

curreyr@argus.CS.ORST.EDU (Robert W. Currey) (03/29/91)

How does one have mpw invoke System 7.0 aliases?

I want to be able to put aliases to my favorite apps into
my MPW tools folder and be able to invoke them as an MPW 
tool. For example when I put an alias to resedit into my
tools folder I get

	### MPW Shell - File "resedit" is not executable.

Any ideas on how I can get this to work (without placing
the actual application in the {commands} path)?

-Rob Currey
currey@argus.math.orst.edu

nerm@Apple.COM (Dean Yu) (03/29/91)

In article <1991Mar29.010609.6355@lynx.CS.ORST.EDU> curreyr@argus.UUCP (Robert W. Currey) writes:
>
>How does one have mpw invoke System 7.0 aliases?
>

  The current version of MPW doesn't know about aliases, so you can't do what
you want to do easily...  A properly placed patch on whatever MPW uses to
open files to check to see if it's an alias and if so, resolve it before
returning would do the trick...  (The MPW guys are probably going to kill me
for even suggesting that...)

  -- Dean Yu
     Blue Meanie, Negative Ethnic Role Model, etc.
     Apple Computer, Inc.
     My opinions and so on and so forth...

dorner@pequod.cso.uiuc.edu (Steve Dorner) (03/29/91)

In article <50943@apple.Apple.COM> nerm@Apple.COM (Dean Yu) writes:
>  The current version of MPW doesn't know about aliases, so you can't do what
>you want to do easily...

I guess this is old news, but you mean that system 7 aliases require
cooperation from my application?

Surrealism is alive and well, and living in the Macintosh filesystem...
--
Steve Dorner, U of Illinois Computing Services Office
Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner

nerm@Apple.COM (Dean Yu) (03/30/91)

In article <1991Mar29.144130.25920@ux1.cso.uiuc.edu> dorner@pequod.cso.uiuc.edu (Steve Dorner) writes:
>In article <50943@apple.Apple.COM> I wrote:
>>  The current version of MPW doesn't know about aliases, so you can't do what
>>you want to do easily...
>
>I guess this is old news, but you mean that system 7 aliases require
>cooperation from my application?

  In a sense.  If the user double clicks an alias to a document in the Finder,
the Finder will resolve the alias before passing the Open to the application.
Standard File also automatically resolves aliases for you.  (Which is kind of
a pain when you're trying to open the actual alias file in ResEdit, but that's
another story...)
  Basically, if you get files by going through an interface that we provide,
like Standard File or the Finder, then you don't have to change a thing.  When
you make direct calls to the file system, that's when you have to do the extra
work of checking to see if the file you're writing to is the real file or an
alias, and if it's an alias, call _ResolveAlias.  (Say someone made an alias
to your preferences file, and moved that somewhere else.  If you don't check
to see if it's an alias, you'll wind up writing into the alias file, and not
into the real preferences file.)

>
>Surrealism is alive and well, and living in the Macintosh filesystem...

  Breeding like rabbits is probably more apt...

  -- Dean Yu
     Blue Meanie, Negative Ethnic Role Model, etc.
     Apple Computer, Inc.
     My opinions and so on and so forth...

lsr@Apple.COM (Larry Rosenstein) (03/30/91)

In article <1991Mar29.010609.6355@lynx.CS.ORST.EDU> curreyr@argus.UUCP (Robert W. Currey) writes:
>
>How does one have mpw invoke System 7.0 aliases?
>
>I want to be able to put aliases to my favorite apps into
>my MPW tools folder and be able to invoke them as an MPW 

An alias file is simply a normal file that contains information about the
thing to which it refers.  It is up to the application to resolve the alias.
Once exception is that Std File automatically resolves the alias, so the
application only sees the "real file".

You can always define MPW aliases that refer to the real files (e.g. alias
ResEdit Foo:Bar:Apps:ResEdit) and not use System 7 aliases.

If you want to deal with System 7 aliases, you would need an MPW tool that
resolves the alias, using the appropriate ROM call.  Then you could do
`ResolveAlias "ResEdit Alias"`.  (Or combine the 2 approaches: alias ResEdit
'`ResolveAlias "ResEditAlias"`'.)

I wrote a tool that resolves aliases, although it's not as polished as the
normal MPW tools.  I'll post it to comp.binaries.mac, along with a couple
other MPW/System 7 goodies.

-- 
		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 3-PK  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr

drc@claris.com (Dennis Cohen) (03/30/91)

jln@casbah.acns.nwu.edu (John Norstad) writes:

>In article <1991Mar29.144130.25920@ux1.cso.uiuc.edu> 
>dorner@pequod.cso.uiuc.edu (Steve Dorner) writes:
>> I guess this is old news, but you mean that system 7 aliases require
>> cooperation from my application?
>> 
>> Surrealism is alive and well, and living in the Macintosh filesystem...

>Both the Finder and the Standard File Package understand aliases. This 
>covers 99% of the relevant cases, so it's not such a big deal. MPW will 
>understand them too in the near future, I'm sure.

>Long live surrealism!

You should remember that one of the things that MPW does is install an
"alternate file system" that treats its windows as files.  Since it isn't
dealing with the "standard" file system, it probably needs to do something
special to support aliases in the alternate filesystem.

However, if you are mucking in the filesystem yourself rather than going
through the Standard File package, you will need to call ResolveAlias
yourself when the file is an alias.

-- 
| Dennis Cohen     drc@claris.com   COHEN2   AFC DCohen    71076,1377
|                  Internet       AppleLink  AmerOnline    CompuServe
| Disclaimer:  Any unattributed opinions expressed above are _MINE_!

kent@sunfs3.Camex.COM (Kent Borg) (04/02/91)

In article <1991Mar29.144130.25920@ux1.cso.uiuc.edu> 
dorner@pequod.cso.uiuc.edu (Steve Dorner) writes:
> I guess this is old news, but you mean that system 7 aliases require
> cooperation from my application?
> 
> Surrealism is alive and well, and living in the Macintosh filesystem...

Well, no.  This is another case of you people confusing features with
bugs.

7.0 aliases are not part of the file system, they are higher level
things, figments of the imaginations of Finder and Standard File--and
any other code that likes the same drugs.  They are also compatible
with the old file system--though not usable by an old system.  (You
know, no reformatting your hard disk with a new file structure to
implement aliases.)

By being high level beasts, alaises can fairly easily do things like
search for files that have moved or changed their file id's, they can
also automatically mount an AppleShare volume, etc.

By being high level beasts, they cannot help out the application that
tries to open the alias directly.  (Imagine that!, trying to open a
file...)

I know I like 7.0 aliases better than Unix links, but I am sure they
are going to cause my Mom some major confusions, and I am not sure I
like the level at which they were implemented.  Ask me in a year.

I will suggest that it might be nice if the crucial File Manager
calls were updated to resolve aliases without being asked--so long as
we can still open the alias itself.

In article <1991Mar29.190809.25417@casbah.acns.nwu.edu> jln@casbah.acns.nwu.edu (John Norstad) writes:
>Long live surrealism!

And surrealism is nothing new for the Mac.  We have had HFS for awhile
now...


--
Kent Borg                            internet: kent@camex.com   AOL: kent borg
                                            H:(617) 776-6899  W:(617) 426-3577
"We foolishly did not realize that he was stupid."  - April Glasbie 3-20-91

greggor@Apple.COM (Greg L. Anderson) (04/02/91)

In article <50968@apple.Apple.COM> nerm@Apple.COM (Dean Yu) writes:
>Standard File also automatically resolves aliases for you.  (Which is kind of
>a pain when you're trying to open the actual alias file in ResEdit, but that's
>another story...)

The easy way to get around this problem is to open the alias with
the 7.0 finder.  Make an alias to ResEdit & keep it on the desktop.
When you want to look at an alias file, drop the alias file on top
of your ResEdit alias.  The Finder will launch ResEdit, which will
not resolve the alias before opening it.  Nifty.

The implication of this is that your app must resolve the alias
manually if it supports the "drop launch" feature of 7.0.

-- 
 ___\    /___   Greg Anderson  (6 kyu)   ___\    /___
 \   \  /   /   User Programming Group   \   \  /   /    ()   "Ponnuki 
  \  /\/\  /     Apple Computer, Inc.     \  /\/\  /   ()  ()  is ideal
   \/    \/       greggor@apple.com        \/    \/      ()    shape."

dorner@pequod.cso.uiuc.edu (Steve Dorner) (04/02/91)

In article <1902@camex.COM> kent@sunfs3.Camex.COM (Kent Borg) writes:
>7.0 aliases are not part of the file system, they are higher level
>things, figments of the imaginations of Finder and Standard File--and
>any other code that likes the same drugs.

Sounds like how folders were under MFS, and file comments are now.
You just can't keep a good idea down, I guess.
--
Steve Dorner, U of Illinois Computing Services Office
Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner

greggor@Apple.COM (Greg L. Anderson) (04/03/91)

In article <51041@apple.Apple.COM> I wrote:
>The easy way to get around this problem <trying to load an alias in ResEdit>
>is to open the alias with the 7.0 finder....
>When you want to look at an alias file, drop the alias file on top
>of your ResEdit alias.

I was wrong.  My system was broken, now it's fixed, but I liked the
broken behavior better.  So, how _do_ you open alias files in ResEdit?
I wasn't able to do it.
-- 
 ___\    /___   Greg Anderson  (6 kyu)   ___\    /___
 \   \  /   /   User Programming Group   \   \  /   /    ()   "Ponnuki 
  \  /\/\  /     Apple Computer, Inc.     \  /\/\  /   ()  ()  is ideal
   \/    \/       greggor@apple.com        \/    \/      ()    shape."

rae@alias.com (Reid Ellis) (04/07/91)

Greg L Anderson <greggor@Apple.COM> writes:
>I was wrong.  My system was broken, now it's fixed, but I liked the
>broken behavior better.  So, how _do_ you open alias files in ResEdit?
>I wasn't able to do it.

Go into MPW and type "rededit <alias>".  Being a good developer,
you're *ALWAYS* running MPW, aren't you? :-) ;-)

							Reid
--
Reid Ellis     1 Trefan Street Apt. E, Toronto ON, M5A 3A9
rae@utcs.toronto.edu        ||  rae%alias@csri.toronto.edu
CDA0610@applelink.apple.com ||      +1 416 362 9181 [work]