discuss-gnustep
[Top][All Lists]
Advanced

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

Re: GNUstep "open" tool


From: Gregory Casamento
Subject: Re: GNUstep "open" tool
Date: Thu, 22 Nov 2001 07:19:52 -0800 (PST)

Jeff

Actually, I just checked on my NeXT box running OS4.2, the OPENSTEP "open"
doesn't do this.  When I say:

open OpenUp.app  (which is in LocalApps on my machine) 

from a terminal and I am not in a directory which contains the application, it
does not automatically launch the application.  It says "Can't stat file
/home/heron/OpenUp.app."  I have tried with several other applications as well.
  On the other hand, when I type "open somthing.zip" it does get opened or when
I go to LocalApps and type "open OpenUp.app" it starts as well.

I'm wondering if this could be added as a "feature" for GNUstep, but I'm
tempted to maintain compatibility.

Later, GJC

--- Jeff Teunissen <deek@d2dc.net> wrote:
> Gregory Casamento wrote:
> > 
> > I committed this to the repository.   The tool is called "gopen" and is
> > in the gui/Tools directory.  Just a few notes on it:
> > 
> > 1) You must have installed the applications into the appropriate
> > "well-known" locations for this to work when opening a file.  When
> > make_services scans all of the applications it builds a plist called
> > .GNUstepAppList in the ~/GNUstep/Services directory.
> > 
> > 2) The application must declare which files it handles in it's
> > Info-gnustep.plist (under Resources in the app wrapper) file since this
> > is what make_services uses to build the file mentioned above.
> > 
> > I have tested this with Gorm.app, Ink.app and ImageViewer.app and it
> > seems to work very well.
> > 
> > Please let me know if there are any issues.
> 
> I just patched gopen locally, to make it search the well-known paths for
> apps,
> like *step "open" does. It's attached to this message, if you'd like to
> include it or something similar into the standard gopen.
> 
> [snip]
> 
> -- 
> | Jeff Teunissen  -=-  Pres., Dusk To Dawn Computing  -=-  deek @ 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/>
Index: gopen.m
> ===================================================================
> RCS file: /cvsroot/gnustep/gnustep/core/gui/Tools/gopen.m,v
> retrieving revision 1.1
> diff -u -r1.1 gopen.m
> --- gopen.m   2001/11/18 19:01:07     1.1
> +++ gopen.m   2001/11/22 08:12:36
> @@ -27,6 +27,8 @@
>  #include <Foundation/NSTask.h>
>  #include <Foundation/NSAutoreleasePool.h>
>  #include <Foundation/NSException.h>
> +#include <Foundation/NSPathUtilities.h>
> +#include <Foundation/NSFileManager.h>
>  #include <AppKit/NSApplication.h>
>  #include <AppKit/NSWorkspace.h>
>  
> @@ -72,14 +74,31 @@
>         {
>           if( [ext isEqualToString: @"app"] )
>             {
> +             NSFileManager *fm = [NSFileManager defaultManager];
>               NSString *appName = 
>                 [[file lastPathComponent] stringByDeletingPathExtension];
>               NSString *executable = 
>                 [file stringByAppendingPathComponent: appName];
> -             NSTask *task = nil;
> -
> -             if ([NSTask launchedTaskWithLaunchPath: executable arguments: 
> nil] == nil)
> -               printf("Unable to launch application at path %s.\n",[file 
> cString]);
> +             
> +             if ( [fm fileExistsAtPath: executable] )
> +               {
> +                 if ( ![NSTask launchedTaskWithLaunchPath: executable 
> arguments: nil] )
> +                   printf("Unable to launch application at path %s.\n",[file 
> cString]);
> +               }
> +             else
> +               {
> +                 NSString *fullPath;
> +                 NSEnumerator *pathEnumerator = 
> +                   
> [NSSearchPathForDirectoriesInDomains(NSApplicationDirectory,
> NSAllDomainsMask, YES) objectEnumerator];
> +                 
> +                 while ((fullPath = [pathEnumerator nextObject]))
> +                   {
> +                     if ( ![fm fileExistsAtPath: [fullPath 
> stringByAppendingPathComponent:
> file]] )
> +                       continue;
> +                     [NSTask launchedTaskWithLaunchPath: [fullPath
> stringByAppendingPathComponent: executable] arguments: nil];
> +                     break;
> +                   }
> +               }
>             }
>           else
>             {
> 


=====
Gregory John Casamento
------------------------------------------------------
Please sign the petition against software patents at:
http://www.petitiononline.com/pasp01/petition.html
------------------------------------------------------

__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1



reply via email to

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