discuss-gnustep
[Top][All Lists]
Advanced

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

Re: GNUstep equivalent to the "open" tool.


From: Richard Frith-Macdonald
Subject: Re: GNUstep equivalent to the "open" tool.
Date: Sun, 25 Mar 2001 10:21:34 +0100

On Sunday, March 25, 2001, at 10:00 AM, strobe anarkhos wrote:

> Shouldn't this be part of the WindowMaker project and not GNUStep? 

Well, Window Maker would have to have intimate knowledge of the GNUstep stuff 
... and
would have to link with libobjc to use GNUstep code directly, so I think it 
makes more
sense as a GNUstep tool (probably best placed in core/gui/Tools).

We could write an open tool pretty trivially ... all it would need to do is 
instantiate
an NSWorkspace object and call the -openFile: method passing it the name of the 
file to
be opened!

> By the way, in OS X the open command will do different things depending on 
> runtime 
> conditions. If a specific app or document is already open it will be brought 
> to the 
> foreground. If I want to run two copies of an application I have to do make a 
> copy of the app and 
> 'open' both. 'open' somehow knows when a file is being used by a specific 
> user. Of course you 
> can open a document in two applications at the same time by specifying the 
> apps explicitly. 

The NSWorkspace -openFile: method should do all that ... it uses the suffix of 
the filename
to locate the application to use, tries to connect to a running copy of the app 
and ask it
to open the file, and if it can't find a running copy, launches the app.

If a particular application is required, you would use the 
-openFile:withApplication: method,
which does the same thing except that it skips the bit about determining the 
app to use from
the filename suffix.


reply via email to

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