Changeset 1073

Show
Ignore:
Timestamp:
07/18/08 02:30:20 (7 weeks ago)
Author:
gyoung
Message:

Fm2 uses TMP/TEMP directory if set for temporary files and directories. Ticket 20

Location:
trunk/dll
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r1069 r1073  
    339339  if (pai->pszFileName && pai->pszFileName != NullStr) { 
    340340    psz = pai->pszFileName; 
    341     pai->pszFileName = NullStr; 
     341    pai->pszFileName = NULL; 
    342342    free(psz); 
    343343  } 
     
    14741474        free(s); 
    14751475        if (IsFile(filename) == 1) { 
    1476 #if 1 // 06 Oct 07 SHL fixme to be gone - set to 0 for ticket #58 testing 
     1476#if 0 // 06 Oct 07 SHL fixme to be gone - set to 0 for ticket #58 testing 
    14771477          if (fViewChild && fArcStuffVisible) 
    14781478            DosSleep(100);  // Allow unzip session to finish closing 14 Mar 07 SHL 
     
    18571857 
    18581858                FILE *fp; 
    1859                 CHAR TempFile[CCHMAXPATH]; 
     1859                CHAR szTempFile[CCHMAXPATH]; 
    18601860 
    18611861                if (fUseTmp) 
    1862                   BldFullPathName(TempFile, pTmpDir, "$FM2PLAY.$$$"); 
     1862                  BldFullPathName(szTempFile, pTmpDir, "$FM2PLAY.$$$"); 
    18631863                else 
    1864                   strcpy(TempFile, "$FM2PLAY.$$$"); 
    1865  
    1866                 fp = xfopen(TempFile, "w", pszSrcFile, __LINE__); 
     1864                  strcpy(szTempFile, "$FM2PLAY.$$$"); 
     1865 
     1866                fp = xfopen(szTempFile, "w", pszSrcFile, __LINE__); 
    18671867                if (fp) { 
    18681868                  fprintf(fp, "%s", ";AV/2-built FM2Play listfile\n"); 
     
    18711871                  fprintf(fp, ";end\n"); 
    18721872                  fclose(fp); 
    1873                   strrev(TempFile); 
    1874                   strcat(TempFile, "@/"); 
    1875                   strrev(TempFile); 
    1876                   RunFM2Util("FM2PLAY.EXE", TempFile); 
     1873                  strrev(szTempFile); 
     1874                  strcat(szTempFile, "@/"); 
     1875                  strrev(szTempFile); 
     1876                  RunFM2Util("FM2PLAY.EXE", szTempFile); 
    18771877                } 
    18781878              } 
     
    19881988              } 
    19891989              BldFullPathName(fullname, dcd->directory, li->list[x]); 
    1990               // sprintf(fullname, "%s%s%s", dcd->directory, 
    1991               //              (dcd->directory[strlen(dcd->directory) - 1] == '\\') ? 
    1992               //              NullStr : "\\", li->list[x]); 
    19931990              if (IsFile(fullname) != -1) 
    19941991                if (AddToList(fullname, &list2, &numfiles, &numalloced)) 
     
    20001997                  if (*p) { 
    20011998                    BldFullPathName(fullname, dcd->directory, p); 
    2002                     // sprintf(fullname, "%s%s%s", dcd->directory, 
    2003                     //      (dcd->directory[strlen(dcd->directory) - 1] == 
    2004                     //         '\\') ? NullStr : "\\", 
    2005                     //      p); 
    20061999                    if (IsFile(fullname) != -1) 
    20072000                      if (AddToList(fullname, &list2, &numfiles, &numalloced)) 
     
    20562049      free(dcd); 
    20572050#     ifdef FORTIFY 
    2058       Fortify_LeaveScope(); 
     2051      //Fortify_LeaveScope(); 
    20592052#      endif 
    20602053      WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL); 
     
    30423035                UnHilite(hwnd, TRUE, &dcd->lastselection, 0); 
    30433036            } 
    3044             else 
     3037            else { 
    30453038              free(li); 
    3046 #           ifdef FORTIFY 
    3047             Fortify_LeaveScope(); 
    3048 #           endif 
     3039#             ifdef FORTIFY 
     3040              Fortify_LeaveScope(); 
     3041#              endif 
     3042            } 
    30493043          } 
    30503044        } 
  • trunk/dll/init.c

    r1069 r1073  
    537537    DosFindClose(search_handle); 
    538538  } 
    539  
    540   DosForceDelete("$FM2PLAY.$$$"); 
     539  if (fUseTmp) { 
     540    CHAR szTempFile[CCHMAXPATH]; 
     541 
     542    BldFullPathName(szTempFile, pTmpDir, "$FM2PLAY.$$$"); 
     543    DosForceDelete(szTempFile); 
     544  } 
     545  else 
     546    DosForceDelete("$FM2PLAY.$$$"); 
    541547 
    542548  EndNote(); 
  • trunk/dll/killproc.c

    r1063 r1073  
    3737#include "errutil.h"                    // Dos_Error... 
    3838#include "strutil.h"                    // GetPString 
     39#include "pathutil.h"                   // BldFullPathName 
    3940#include "fm3dll.h" 
    4041#include "fortify.h" 
     
    236237 
    237238  WinSendDlgItemMsg(hwnd, KILL_LISTBOX, LM_DELETEALL, MPVOID, MPVOID); 
    238   strcpy(s, "$PSTAT#$.#$#"); 
     239  if (fUseTmp) 
     240    BldFullPathName(s, pTmpDir, "$PSTAT#$.#$#"); 
     241  else 
     242    strcpy(s, "$PSTAT#$.#$#"); 
    239243  unlinkf("%s", s); 
    240244  fp = fopen(s, "w"); 
     
    303307  } 
    304308Abort: 
    305   DosForceDelete("$PSTAT#$.#$#"); 
     309  if (fUseTmp) { 
     310    CHAR szTempFile[CCHMAXPATH]; 
     311 
     312    BldFullPathName(szTempFile, pTmpDir, "$PSTAT#$.#$#"); 
     313    DosForceDelete(szTempFile); 
     314  } 
     315  else 
     316    DosForceDelete("$PSTAT#$.#$#"); 
    306317  PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID); 
    307318  WinDestroyMsgQueue(thmq); 
  • trunk/dll/sysinfo.c

    r907 r1073  
    2424#define INCL_LONGLONG 
    2525 
     26#include "pathutil.h"                   // BldFullPathName 
    2627#include "fm3dlg.h" 
    2728#include "fm3dll.h" 
     
    3435{ 
    3536  HWND hwnd = (HWND) arg; 
    36   CHAR s[2048], *p; 
     37  CHAR s[2048], *p, szTempFile[CCHMAXPATH]; 
    3738  HAB thab; 
    3839  HMQ thmq; 
     
    4849    if (!WinIsWindow(thab, hwnd)) 
    4950      goto Abort; 
    50     unlinkf("%s", "$RMVIEW.#$#"); 
    51     fp = xfopen("$RMVIEW.#$#", "w", pszSrcFile, __LINE__); 
     51    if (fUseTmp) 
     52      BldFullPathName(szTempFile, pTmpDir, "$RMVIEW.#$#"); 
     53    else 
     54      strcpy(szTempFile, "$RMVIEW.#$#"); 
     55    unlinkf("%s", szTempFile); 
     56    fp = xfopen(szTempFile, "w", pszSrcFile, __LINE__); 
    5257    if (!fp) 
    5358      goto Abort; 
     
    6267      runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT, 
    6368              hwnd, pszSrcFile, __LINE__, 
    64               NULL, NULL, "%s", "RMVIEW.EXE"); 
     69              NULL, NULL, "%s", szTempFile); 
    6570      oldstdout = fileno(stdout); 
    6671      DosDupHandle(newstdout, &oldstdout); 
     
    7075    if (!WinIsWindow(thab, hwnd)) 
    7176      goto Abort; 
    72     fp = xfopen("$RMVIEW.#$#", "r", pszSrcFile, __LINE__); 
     77    fp = xfopen(szTempFile, "r", pszSrcFile, __LINE__); 
    7378    if (fp) { 
    7479      xfgets(s, sizeof(s), fp, pszSrcFile, __LINE__); 
     
    98103    WinTerminate(thab); 
    99104  } 
    100   DosForceDelete("$RMVIEW.#$#"); 
     105  if (szTempFile) 
     106    DosForceDelete(szTempFile); 
    101107} 
    102108 
  • trunk/dll/undel.c

    r1063 r1073  
    3131#include "errutil.h"                    // Dos_Error... 
    3232#include "strutil.h"                    // GetPString 
     33#include "pathutil.h"                   // BldFullPathName 
    3334#include "fm3dll.h" 
    3435#include "fortify.h" 
     
    4849{ 
    4950  HWND hwnd; 
    50   CHAR s[CCHMAXPATH * 2]; 
     51  CHAR s[CCHMAXPATH * 2], szTempFile[CCHMAXPATH]; 
    5152  CHAR *path; 
    5253  HAB thab; 
     
    7273    IncrThreadUsage(); 
    7374    WinSendDlgItemMsg(hwnd, UNDEL_LISTBOX, LM_DELETEALL, MPVOID, MPVOID); 
    74     unlinkf("%s", "$UDELETE.#$#"); 
    75     fp = xfopen("$UDELETE.#$#", "w", pszSrcFile, __LINE__); 
     75    if (fUseTmp) 
     76      BldFullPathName(szTempFile, pTmpDir, "$UDELETE.#$#"); 
     77    else 
     78      strcpy(szTempFile, "$UDELETE.#$#"); 
     79    unlinkf("%s", szTempFile); 
     80    fp = xfopen(szTempFile, "w", pszSrcFile, __LINE__); 
    7681    if (!fp) { 
    7782      Win_Error(NULLHANDLE, hwnd, pszSrcFile, __LINE__, 
     
    103108      fclose(fp); 
    104109    } 
    105     fp = xfopen("$UDELETE.#$#", "r", pszSrcFile, __LINE__); 
     110    fp = xfopen(szTempFile, "r", pszSrcFile, __LINE__); 
    106111    if (fp) { 
    107112      xfgets(s, sizeof(s), fp, pszSrcFile, __LINE__);   // Skip 1st line 
     
    150155    ; 
    151156  } 
    152   DosForceDelete("$UDELETE.#$#"); 
     157  DosForceDelete(szTempFile); 
    153158  xfree(undelinfo, pszSrcFile, __LINE__); 
    154159  if (thmq) {