Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Quicker in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Quicker in Terminal
Authored by: willjwade on Jan 14, '04 02:22:09PM

Does work but you wont be able to change the icon. No idea why..



[ Reply to This | # ]
Quicker in Terminal
Authored by: hysterion on Jan 15, '04 05:24:19AM
It's because the icon goes in the resource fork, which BSD aliases don't have.
To get a Mac alias from the command line, use this method:
localhost:~ fz$ python -c """from macostools import *
> mkalias('.Trash','Desktop/MacAlias')"""
You may then glue the Trash icon onto the alias as explained here,
and check that it all goes into the rsrc fork:
localhost:~ fz$ ls -l Desktop/MacAlias/..namedfork/data Desktop/MacAlias/..namedfork/rsrc
-rw-r--r--  1 fz  fz      0 15 Jan 11:06 Desktop/MacAlias/..namedfork/data
-rw-r--r--  1 fz  fz  54099 15 Jan 11:06 Desktop/MacAlias/..namedfork/rsrc
In contrast ln -s .Trash Desktop/BSDAlias gives a regular file without rsrc fork:
localhost:~ fz$ ls -l Desktop/BSDAlias Desktop/BSDAlias/..namedfork/rsrc
lrwxr-xr-x  1 fz  fz  6 15 Jan 11:10 Desktop/BSDAlias -> .Trash
ls: Desktop/BSDAlias/..namedfork/rsrc: No such file or directory


[ Reply to This | # ]
Quicker in Terminal
Authored by: hysterion on Jan 15, '04 05:37:29AM
P.S. This yoga also lets you actually view what's inside the Mac alias resource fork (here, before gluing the icon):
localhost:~ fz$ hexdump -C Desktop/MacAlias/..namedfork/rsrc
00000000  00 00 01 00 00 00 01 d6  00 00 00 d6 00 00 00 32  |...............2|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000100  00 00 00 d2 00 00 00 00  00 d2 00 02 00 01 04 48  |...............H|
00000110  6f 6d 65 00 00 00 00 00  00 00 00 00 00 00 00 00  |ome.............|
00000120  00 00 00 00 00 00 00 00  00 00 bb d0 8a 36 48 2b  |.............6H+|
00000130  00 00 00 00 00 15 06 2e  54 72 61 73 68 00 00 00  |........Trash...|
00000140  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000170  00 00 00 00 00 00 00 00  00 1b bb d0 69 77 00 00  |............iw..|
00000180  00 00 00 00 00 00 ff ff  ff ff 00 00 09 00 00 00  |................|
00000190  00 00 00 00 00 00 00 00  00 00 00 10 00 08 00 00  |................|
000001a0  bb d0 d0 86 00 00 00 11  00 08 00 00 bb d0 af c7  |................|
000001b0  00 00 00 0e 00 0e 00 06  00 2e 00 54 00 72 00 61  |...........T.r.a|
000001c0  00 73 00 68 00 0f 00 0a  00 04 00 48 00 6f 00 6d  |.s.h.......H.o.m|
000001d0  00 65 ff ff 00 00 00 00  01 00 00 00 01 d6 00 00  |.e..............|
000001e0  00 d6 00 00 00 32 00 20  a0 8c 00 0e 00 00 00 1c  |.....2. ........|
000001f0  00 32 00 00 61 6c 69 73  00 00 00 0a 00 00 ff ff  |.2..alis........|
00000200  00 00 00 00 00 20 a0 9c                           |..... ..|
00000208


[ Reply to This | # ]