home *** CD-ROM | disk | FTP | other *** search
- /* WhereAmI
- *
- * A category of Application that provides methods for finding the
- * application executable and executable directory.
- *
- * Copyright 1991, 1992 Scott Hess. This source code may be
- * redistributed and modified without restriction. Well, one
- * restriction - do not claim that you wrote it.
- *
- * Scott Hess
- * 12901 Upton Avenue South, #326
- * Burnsville, MN 55337
- * (612) 895-1208
- * scott@gac.edu
- * shess@ssesco.com
- */
- #import <appkit/Application.h>
-
- @interface Application (WhereAmI)
- /* I store this category in an ar(1) library of code shared between
- * a number of applications. Unfortunately, categories generate no
- * symbols that allow them to be pulled from the library on link. I
- * put "whereAmIReference=0;" somewhere else in the app just to
- * reference the object module and make certain it's in the app. Most
- * people can simply ignore this ...
- */
- extern int whereAmIReference;
-
- /* Return the path to the executable, if possible. Searches the
- * PATH environment variable, if needed. Also, traces symbolic links
- * if required.
- */
- -(NXAtom)whoAmI;
- /* Returns the directory in which the executable resides. Uses
- * -whoAmI and then strips the last path segment.
- */
- -(NXAtom)whereAmI;
- /* Finds the path to the file specified by file relative to the
- * application's executable directory. Places the path in result and
- * returns result if successful. Returns NULL with result=="" if it
- * could not generate a path. Returns NULL with result==path if it
- * could generate a path, but could not find the file.
- */
- -(const char *)whereIs:(const char *)file path:(char *)result;
- @end
-
-