Changeset 1069 for trunk/dll/init.c


Ignore:
Timestamp:
Jul 17, 2008, 1:53:38 AM (17 years ago)
Author:
Gregg Young
Message:

Fixes trap on viewing multiple files from an archive Ticket 248. Also includes initial code for using TMP directory for Temp files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/init.c

    r1065 r1069  
    650650
    651651  /* set up default root names for temp archive goodies */
    652   if (!fAmAV2)
    653     strcpy(ArcTempRoot, "$FM$ARC$");
    654   else
    655     strcpy(ArcTempRoot, "$AV$ARC$");
     652  env = getenv("TMP");
     653  if (env != NULL) {
     654    DosError(FERR_DISABLEHARDERR);
     655    rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
     656    if (!rc) {
     657      if (fs3.attrFile & FILE_DIRECTORY) {
     658        BldFullPathName(ArcTempRoot, env, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$");
     659        pTmpDir = xstrdup(env, pszSrcFile, __LINE__);
     660        fUseTmp = TRUE;
     661      }
     662    }
     663  }
     664  else {
     665    env = getenv("TEMP");
     666    if (env != NULL) {
     667      DosError(FERR_DISABLEHARDERR);
     668      rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
     669      if (!rc) {
     670        if (fs3.attrFile & FILE_DIRECTORY) {
     671          BldFullPathName(ArcTempRoot, env, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$");
     672          pTmpDir = xstrdup(env, pszSrcFile, __LINE__);
     673          fUseTmp = TRUE;
     674        }
     675      }
     676    }
     677  }
     678  if (!fUseTmp) {
     679    if (!fAmAV2)
     680      strcpy(ArcTempRoot, "$FM$ARC$");
     681    else
     682      strcpy(ArcTempRoot, "$AV$ARC$");
     683  }
    656684
    657685  /* initialize random number generator */
Note: See TracChangeset for help on using the changeset viewer.