Changeset 630 for trunk/dll/systemf.c


Ignore:
Timestamp:
Apr 23, 2007, 12:07:06 AM (18 years ago)
Author:
Gregg Young
Message:

Improved fix of utility app path problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/systemf.c

    r563 r630  
    4040static PSZ pszSrcFile = __FILE__;
    4141
    42 #pragma alloc_text(SYSTEMF,ShowSession,ExecOnList,runemf2)
     42#pragma alloc_text(SYSTEMF,ShowSession,ExecOnList,runemf2,RunFM2Util)
    4343
    4444#define MAXSTRG (4096)                  /* used to build command line strings */
     45
     46//== RunFM2Util() Find and run an app from the FM2utilities ==
     47//== Search PATH plus 2 default install dirs ==
     48
     49INT RunFM2Util(CHAR *appname, CHAR *filename)
     50{
     51    CHAR fbuf[CCHMAXPATH];
     52    APIRET rc, ret = -1;
     53
     54    rc = DosSearchPath(SEARCH_IGNORENETERRS |SEARCH_ENVIRONMENT |
     55                       SEARCH_CUR_DIRECTORY,"PATH",
     56                       appname, fbuf, CCHMAXPATH - 1);
     57      if (rc != 0) {
     58        if (rc != 2){
     59        Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     60                  "DosSearchPath", appname);
     61        return ret;
     62        }
     63        else {
     64        rc = DosSearchPath(0, "UTILS;..\\FM2Utils",
     65                           appname, fbuf, CCHMAXPATH - 1);
     66            if (rc != 0 && rc != 2){
     67              Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     68                        "DosSearchPath", appname);
     69              return ret;
     70            }
     71      }
     72    }
     73    ret = runemf2(SEPARATE | WINDOWED,
     74                  HWND_DESKTOP,
     75                  NULL,
     76                  NULL,
     77                  "%s \"%s\"",
     78                  fbuf, filename);
     79    return ret;
     80}
    4581
    4682//== ShowSession() bring session for foreground ==
Note: See TracChangeset for help on using the changeset viewer.