[Top][All Lists]

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

Re: Symlinks from Tools to Applications

From: Jeff Teunissen
Subject: Re: Symlinks from Tools to Applications
Date: Wed, 21 Feb 2007 02:19:15 -0500
User-agent: Icedove (X11/20061220)

Sašo Kiselkov wrote:
> Why not simply modify openapp to:
> 1. if it is called as "openapp" it would invoke the app given as $1
> 2. otherwise it would invoke the app given as $0


I did this some time ago for Backbone's written-in-ObjC "open" program (which
replaces openapp on install, renaming the old one to "openapp.gnustep"). When
called as "openapp", open takes the first argument to be an application name,
starts it if it is not currently running, and tells it to open the other files
passed on the command line.

If it's run by (almost) any other name, it uses $0 as the name of an
application to be run and does the same.

The key here is that the arguments that people expect to work actually do: the
-NSOpen argument is not for humans, it's for the Workspace Manager (and wasn't
often used by that).

An example:

worf:~> ln -sf /System/Tools/open ~/bin/TextEdit
worf:~> TextEdit
2007-02-21 02:01:17.738 TextEdit[7466] Warning - mouse/pointer seems to have
more than 5 buttons - just using one to five
worf:~> TextEdit dictionary.m
2007-02-21 02:01:58.569 TextEdit[7466] Warning: (NSLayoutManager)
-[NSLayoutManager setHyphenationFactor:] not implemented

No command-line arguments are sent to TextEdit -- instead, DO is used to send
-application:openFile: to it.

The same method works for any other program that can open files -- it even
works for executable files, passing them to Terminal.

If you want to put such functionality into gopen, go ahead and do so...but
openapp is CLEARLY the wrong place.

| Jeff Teunissen -=- Pres., Dusk To Dawn Computing -=- deek at d2dc.net
| GPG: 1024D/9840105A 7102 808A 7733 C2F3 097B 161B 9222 DAB8 9840 105A
| Core developer, The QuakeForge Project     http://www.quakeforge.net/
| Specializing in Debian GNU/Linux           http://www.d2dc.net/~deek/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]