| 1 | 
 | 
|---|
| 2 | /***********************************************************************
 | 
|---|
| 3 | 
 | 
|---|
| 4 |   $Id: getnames.c 1208 2008-09-13 06:50:20Z jbs $
 | 
|---|
| 5 | 
 | 
|---|
| 6 |   Directory containers
 | 
|---|
| 7 | 
 | 
|---|
| 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
| 9 |   Copyright (c) 2006 Steven H. Levine
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   23 Aug 06 SHL Comments
 | 
|---|
| 12 |   20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
 | 
|---|
| 13 | 
 | 
|---|
| 14 | ***********************************************************************/
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include <string.h>
 | 
|---|
| 17 | #include <ctype.h>
 | 
|---|
| 18 | 
 | 
|---|
| 19 | #define INCL_DOS
 | 
|---|
| 20 | #define INCL_WIN
 | 
|---|
| 21 | #define INCL_LONGLONG
 | 
|---|
| 22 | 
 | 
|---|
| 23 | #include "fm3dll.h"
 | 
|---|
| 24 | #include "notebook.h"                   // Data declaration(s)
 | 
|---|
| 25 | #include "info.h"                       // Data declaration(s)
 | 
|---|
| 26 | #include "mainwnd.h"                    // Data declaration(s)
 | 
|---|
| 27 | #include "fm3dlg.h"
 | 
|---|
| 28 | #include "fm3str.h"
 | 
|---|
| 29 | #include "errutil.h"                    // Dos_Error...
 | 
|---|
| 30 | #include "strutil.h"                    // GetPString
 | 
|---|
| 31 | #include "getnames.h"
 | 
|---|
| 32 | #include "walkem.h"                     // load_udirs, remove_udir
 | 
|---|
| 33 | #include "valid.h"                      // MakeFullName
 | 
|---|
| 34 | #include "copyf.h"                      // unlinkf
 | 
|---|
| 35 | #include "misc.h"                       // PaintRecessedWindow
 | 
|---|
| 36 | #include "wrappers.h"                   // xDosFindFirst
 | 
|---|
| 37 | 
 | 
|---|
| 38 | #pragma data_seg(DATA1)
 | 
|---|
| 39 | 
 | 
|---|
| 40 | MRESULT EXPENTRY CustomFileDlg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 41 | {
 | 
|---|
| 42 |   switch (msg) {
 | 
|---|
| 43 |   case WM_INITDLG:
 | 
|---|
| 44 |     if (!loadedudirs)
 | 
|---|
| 45 |       load_udirs();
 | 
|---|
| 46 |     {                                   /* fill user list box */
 | 
|---|
| 47 |       ULONG ulDriveNum, ulDriveMap;
 | 
|---|
| 48 |       ULONG ulSearchCount;
 | 
|---|
| 49 |       FILEFINDBUF3L findbuf;
 | 
|---|
| 50 |       HDIR hDir;
 | 
|---|
| 51 |       APIRET rc;
 | 
|---|
| 52 |       LINKDIRS *info, *temp;
 | 
|---|
| 53 | 
 | 
|---|
| 54 |       DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 55 |       DosQCurDisk(&ulDriveNum, &ulDriveMap);
 | 
|---|
| 56 |       info = udirhead;
 | 
|---|
| 57 |       while (info) {
 | 
|---|
| 58 |         if (IsFullName(info->path) &&
 | 
|---|
| 59 |             !(driveflags[toupper(*info->path) - 'A'] &
 | 
|---|
| 60 |               (DRIVE_IGNORE | DRIVE_INVALID))) {
 | 
|---|
| 61 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 62 |           hDir = HDIR_CREATE;
 | 
|---|
| 63 |           ulSearchCount = 1L;
 | 
|---|
| 64 |           if (!IsRoot(info->path))
 | 
|---|
| 65 |             rc = xDosFindFirst(info->path, &hDir, FILE_DIRECTORY |
 | 
|---|
| 66 |                                MUST_HAVE_DIRECTORY | FILE_READONLY |
 | 
|---|
| 67 |                                FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
 | 
|---|
| 68 |                                &findbuf, sizeof(FILEFINDBUF3L),
 | 
|---|
| 69 |                                &ulSearchCount, FIL_STANDARDL);
 | 
|---|
| 70 |           else {
 | 
|---|
| 71 |             rc = 0;
 | 
|---|
| 72 |             findbuf.attrFile = FILE_DIRECTORY;
 | 
|---|
| 73 |           }
 | 
|---|
| 74 |           if (!rc) {
 | 
|---|
| 75 |             if (!IsRoot(info->path))
 | 
|---|
| 76 |               DosFindClose(hDir);
 | 
|---|
| 77 |             if (findbuf.attrFile & FILE_DIRECTORY)
 | 
|---|
| 78 |               WinSendDlgItemMsg(hwnd, FDLG_USERDIRS, LM_INSERTITEM,
 | 
|---|
| 79 |                                 MPFROM2SHORT(LIT_SORTASCENDING, 0),
 | 
|---|
| 80 |                                 MPFROMP(info->path));
 | 
|---|
| 81 |             else {
 | 
|---|
| 82 |               temp = info->next;
 | 
|---|
| 83 |               remove_udir(info->path);
 | 
|---|
| 84 |               info = temp;
 | 
|---|
| 85 |               continue;
 | 
|---|
| 86 |             }
 | 
|---|
| 87 |           }
 | 
|---|
| 88 |           else if (!(ulDriveMap & (1L << (toupper(*info->path) - 'A')))) {
 | 
|---|
| 89 |             temp = info->next;
 | 
|---|
| 90 |             remove_udir(info->path);
 | 
|---|
| 91 |             info = temp;
 | 
|---|
| 92 |             continue;
 | 
|---|
| 93 |           }
 | 
|---|
| 94 |         }
 | 
|---|
| 95 |         info = info->next;
 | 
|---|
| 96 |       }
 | 
|---|
| 97 |     }
 | 
|---|
| 98 |     break;
 | 
|---|
| 99 | 
 | 
|---|
| 100 |   case WM_ADJUSTWINDOWPOS:
 | 
|---|
| 101 |     PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
 | 
|---|
| 102 |     break;
 | 
|---|
| 103 | 
 | 
|---|
| 104 |   case UM_SETDIR:
 | 
|---|
| 105 |     PaintRecessedWindow(WinWindowFromID(hwnd, FDLG_HELP),
 | 
|---|
| 106 |                         (HPS) 0, FALSE, TRUE);
 | 
|---|
| 107 |     return 0;
 | 
|---|
| 108 | 
 | 
|---|
| 109 |   case WM_CONTROL:
 | 
|---|
| 110 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 111 |     case 260:                           /* drives dropdown list */
 | 
|---|
| 112 |       switch (SHORT2FROMMP(mp1)) {
 | 
|---|
| 113 |       case CBN_SHOWLIST:
 | 
|---|
| 114 |         WinSetDlgItemText(hwnd,
 | 
|---|
| 115 |                           FDLG_HELP, GetPString(IDS_CLICKDRIVEHELPTEXT));
 | 
|---|
| 116 |         break;
 | 
|---|
| 117 |       }
 | 
|---|
| 118 |       break;
 | 
|---|
| 119 | 
 | 
|---|
| 120 |     case 258:                           /* name entry field */
 | 
|---|
| 121 |       switch (SHORT2FROMMP(mp1)) {
 | 
|---|
| 122 |       case EN_SETFOCUS:
 | 
|---|
| 123 |         WinSetDlgItemText(hwnd,
 | 
|---|
| 124 |                           FDLG_HELP, GetPString(IDS_ENTERFILEORMASKHELPTEXT));
 | 
|---|
| 125 |         break;
 | 
|---|
| 126 |       case EN_KILLFOCUS:
 | 
|---|
| 127 |         WinSetDlgItemText(hwnd, FDLG_HELP, GetPString(IDS_NAMEDEFHELPTEXT));
 | 
|---|
| 128 |         break;
 | 
|---|
| 129 |       }
 | 
|---|
| 130 |       break;
 | 
|---|
| 131 | 
 | 
|---|
| 132 |     case 264:                           /* dirs listbox */
 | 
|---|
| 133 |       switch (SHORT2FROMMP(mp1)) {
 | 
|---|
| 134 |       case LN_SETFOCUS:
 | 
|---|
| 135 |         WinSetDlgItemText(hwnd,
 | 
|---|
| 136 |                           FDLG_HELP, GetPString(IDS_DBLCLKDIRSWITCHHELPTEXT));
 | 
|---|
| 137 |         break;
 | 
|---|
| 138 |       case LN_KILLFOCUS:
 | 
|---|
| 139 |         WinSetDlgItemText(hwnd, FDLG_HELP, GetPString(IDS_NAMEDEFHELPTEXT));
 | 
|---|
| 140 |         break;
 | 
|---|
| 141 |       }
 | 
|---|
| 142 |       break;
 | 
|---|
| 143 | 
 | 
|---|
| 144 |     case 266:                           /* files listbox */
 | 
|---|
| 145 |       switch (SHORT2FROMMP(mp1)) {
 | 
|---|
| 146 |       case LN_SETFOCUS:
 | 
|---|
| 147 |         WinSetDlgItemText(hwnd, FDLG_HELP,
 | 
|---|
| 148 |                           GetPString(IDS_DBLCLKFILEUSEHELPTEXT));
 | 
|---|
| 149 |         break;
 | 
|---|
| 150 |       case LN_KILLFOCUS:
 | 
|---|
| 151 |         WinSetDlgItemText(hwnd, FDLG_HELP, GetPString(IDS_NAMEDEFHELPTEXT));
 | 
|---|
| 152 |         break;
 | 
|---|
| 153 |       }
 | 
|---|
| 154 |       break;
 | 
|---|
| 155 | 
 | 
|---|
| 156 |     case FDLG_USERDIRS:
 | 
|---|
| 157 |       switch (SHORT2FROMMP(mp1)) {
 | 
|---|
| 158 |       case CBN_SHOWLIST:
 | 
|---|
| 159 |         WinSetDlgItemText(hwnd,
 | 
|---|
| 160 |                           FDLG_HELP, GetPString(IDS_DBLCLKDIRSWITCHHELPTEXT));
 | 
|---|
| 161 |         break;
 | 
|---|
| 162 |       case CBN_ENTER:
 | 
|---|
| 163 |         {
 | 
|---|
| 164 |           SHORT sSelect;
 | 
|---|
| 165 |           CHAR szBuffer[CCHMAXPATH], szTemp[CCHMAXPATH], *p;
 | 
|---|
| 166 | 
 | 
|---|
| 167 |           sSelect = (USHORT) WinSendDlgItemMsg(hwnd,
 | 
|---|
| 168 |                                                FDLG_USERDIRS,
 | 
|---|
| 169 |                                                LM_QUERYSELECTION,
 | 
|---|
| 170 |                                                MPVOID, MPVOID);
 | 
|---|
| 171 |           *szBuffer = 0;
 | 
|---|
| 172 |           if (sSelect >= 0) {
 | 
|---|
| 173 |             WinSendDlgItemMsg(hwnd,
 | 
|---|
| 174 |                               FDLG_USERDIRS,
 | 
|---|
| 175 |                               LM_QUERYITEMTEXT,
 | 
|---|
| 176 |                               MPFROM2SHORT(sSelect,
 | 
|---|
| 177 |                                            CCHMAXPATH), MPFROMP(szBuffer));
 | 
|---|
| 178 |             if (*szBuffer) {
 | 
|---|
| 179 |               if (szBuffer[strlen(szBuffer) - 1] != '\\')
 | 
|---|
| 180 |                 strcat(szBuffer, "\\");
 | 
|---|
| 181 |               *szTemp = 0;
 | 
|---|
| 182 |               WinQueryDlgItemText(hwnd, 258, CCHMAXPATH, szTemp);
 | 
|---|
| 183 |               p = strrchr(szTemp, '\\');
 | 
|---|
| 184 |               if (!p)
 | 
|---|
| 185 |                 p = szTemp;
 | 
|---|
| 186 |               else
 | 
|---|
| 187 |                 p++;
 | 
|---|
| 188 |               if (*p)
 | 
|---|
| 189 |                 strcat(szBuffer, p);
 | 
|---|
| 190 |               if (!strchr(szBuffer, '?') && !strchr(szBuffer, '*'))
 | 
|---|
| 191 |                 strcat(szBuffer, "*");
 | 
|---|
| 192 |               WinSetDlgItemText(hwnd, 258, szBuffer);
 | 
|---|
| 193 |               PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
 | 
|---|
| 194 |             }
 | 
|---|
| 195 |           }
 | 
|---|
| 196 |         }
 | 
|---|
| 197 |         break;
 | 
|---|
| 198 |       default:
 | 
|---|
| 199 |         break;
 | 
|---|
| 200 |       }
 | 
|---|
| 201 |       break;
 | 
|---|
| 202 |     }
 | 
|---|
| 203 |     break;
 | 
|---|
| 204 | 
 | 
|---|
| 205 |   case WM_HELP:
 | 
|---|
| 206 |     if (hwndHelp) {
 | 
|---|
| 207 |       WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
 | 
|---|
| 208 |                  MPFROM2SHORT(HELP_FILEDLG, 0), MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
| 209 |       return 0;
 | 
|---|
| 210 |     }
 | 
|---|
| 211 |     break;
 | 
|---|
| 212 |   }
 | 
|---|
| 213 |   return WinDefFileDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 214 | }
 | 
|---|
| 215 | 
 | 
|---|
| 216 | BOOL insert_filename(HWND hwnd, CHAR * filename, INT loadit, BOOL newok)
 | 
|---|
| 217 | {
 | 
|---|
| 218 |   FILEDLG fdlg;
 | 
|---|
| 219 |   FILESTATUS3 fsa;
 | 
|---|
| 220 |   CHAR drive[3], *pdrive = drive, *p;
 | 
|---|
| 221 |   APIRET rc;
 | 
|---|
| 222 |   static CHAR lastfilename[CCHMAXPATH] = "";
 | 
|---|
| 223 | 
 | 
|---|
| 224 |   if (!filename)
 | 
|---|
| 225 |     return FALSE;
 | 
|---|
| 226 |   memset(&fdlg, 0, sizeof(FILEDLG));
 | 
|---|
| 227 |   fdlg.cbSize = (ULONG) sizeof(FILEDLG);
 | 
|---|
| 228 |   fdlg.fl = FDS_CENTER | FDS_OPEN_DIALOG;
 | 
|---|
| 229 |   if (!loadit) {
 | 
|---|
| 230 |     fdlg.pszTitle = GetPString(IDS_ENTERFILEINSERTTEXT);
 | 
|---|
| 231 |     fdlg.pszOKButton = GetPString(IDS_INSERTTEXT);
 | 
|---|
| 232 |   }
 | 
|---|
| 233 |   else if (loadit == TRUE) {
 | 
|---|
| 234 |     fdlg.pszTitle = GetPString(IDS_ENTERFILELOADTEXT);
 | 
|---|
| 235 |     fdlg.pszOKButton = GetPString(IDS_LOADTEXT);
 | 
|---|
| 236 |   }
 | 
|---|
| 237 |   else {
 | 
|---|
| 238 |     fdlg.pszTitle = GetPString(IDS_ENTERFILETEXT);
 | 
|---|
| 239 |     fdlg.pszOKButton = GetPString(IDS_OKAYTEXT);
 | 
|---|
| 240 |   }
 | 
|---|
| 241 |   if (IsFullName(filename)) {
 | 
|---|
| 242 |     *drive = *filename;
 | 
|---|
| 243 |     drive[1] = ':';
 | 
|---|
| 244 |     drive[2] = 0;
 | 
|---|
| 245 |     fdlg.pszIDrive = pdrive;
 | 
|---|
| 246 |   }
 | 
|---|
| 247 |   else if (*lastfilename) {
 | 
|---|
| 248 |     *drive = *lastfilename;
 | 
|---|
| 249 |     drive[1] = ':';
 | 
|---|
| 250 |     drive[2] = 0;
 | 
|---|
| 251 |     fdlg.pszIDrive = pdrive;
 | 
|---|
| 252 |   }
 | 
|---|
| 253 | 
 | 
|---|
| 254 |   if (!*filename) {
 | 
|---|
| 255 |     if (*lastfilename) {
 | 
|---|
| 256 |       strcpy(fdlg.szFullFile, lastfilename);
 | 
|---|
| 257 |       p = strrchr(fdlg.szFullFile, '\\');
 | 
|---|
| 258 |       if (p) {
 | 
|---|
| 259 |         p++;
 | 
|---|
| 260 |         *p = 0;
 | 
|---|
| 261 |       }
 | 
|---|
| 262 |     }
 | 
|---|
| 263 |     if (!loadit || loadit == TRUE)
 | 
|---|
| 264 |       strcat(fdlg.szFullFile, "*.TXT");
 | 
|---|
| 265 |     else
 | 
|---|
| 266 |       strcat(fdlg.szFullFile, "*");
 | 
|---|
| 267 |   }
 | 
|---|
| 268 |   else
 | 
|---|
| 269 |     strcpy(fdlg.szFullFile, filename);
 | 
|---|
| 270 | 
 | 
|---|
| 271 |   if (fCustomFileDlg) {
 | 
|---|
| 272 |     fdlg.fl |= FDS_HELPBUTTON | FDS_CUSTOM;
 | 
|---|
| 273 |     fdlg.pfnDlgProc = (PFNWP) CustomFileDlg;
 | 
|---|
| 274 |     fdlg.hMod = FM3ModHandle;
 | 
|---|
| 275 |     fdlg.usDlgId = FDLG_FRAME;
 | 
|---|
| 276 |   }
 | 
|---|
| 277 | 
 | 
|---|
| 278 |   if (WinFileDlg(HWND_DESKTOP, hwnd, &fdlg)) {
 | 
|---|
| 279 |     if (fdlg.lReturn != DID_CANCEL && !fdlg.lSRC)
 | 
|---|
| 280 |       strcpy(filename, fdlg.szFullFile);
 | 
|---|
| 281 |     else
 | 
|---|
| 282 |       return FALSE;
 | 
|---|
| 283 |   }
 | 
|---|
| 284 |   else
 | 
|---|
| 285 |     return FALSE;
 | 
|---|
| 286 |   MakeFullName(filename);
 | 
|---|
| 287 |   if (!DosQueryPathInfo(filename, FIL_STANDARD, &fsa, sizeof(fsa))) {
 | 
|---|
| 288 |     if (fsa.attrFile & FILE_DIRECTORY) {
 | 
|---|
| 289 |       /* device or directory */
 | 
|---|
| 290 |       saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
 | 
|---|
| 291 |              hwnd, filename, GetPString(IDS_EXISTSBUTNOTFILETEXT), filename);
 | 
|---|
| 292 |       return FALSE;
 | 
|---|
| 293 |     }
 | 
|---|
| 294 |     else if (fsa.cbFile == 0) {
 | 
|---|
| 295 |       saymsg(MB_CANCEL,
 | 
|---|
| 296 |              hwnd, filename, GetPString(IDS_ISZEROLENGTHTEXT), filename);
 | 
|---|
| 297 |       return FALSE;
 | 
|---|
| 298 |     }
 | 
|---|
| 299 |   }
 | 
|---|
| 300 |   else if (!newok) {
 | 
|---|
| 301 |     saymsg(MB_CANCEL,
 | 
|---|
| 302 |            hwnd, filename, GetPString(IDS_DOESNTEXISTTEXT), filename);
 | 
|---|
| 303 |     return FALSE;
 | 
|---|
| 304 |   }
 | 
|---|
| 305 |   else {
 | 
|---|
| 306 |     rc = saymsg(MB_YESNOCANCEL,
 | 
|---|
| 307 |                 hwnd, filename, GetPString(IDS_CREATENEWTEXT));
 | 
|---|
| 308 |     if (rc != MBID_YES)
 | 
|---|
| 309 |       return FALSE;
 | 
|---|
| 310 |   }
 | 
|---|
| 311 |   p = filename;
 | 
|---|
| 312 |   while (*p) {
 | 
|---|
| 313 |     if (*p == '/')
 | 
|---|
| 314 |       *p = '\\';
 | 
|---|
| 315 |     p++;
 | 
|---|
| 316 |   }
 | 
|---|
| 317 |   if (*filename)
 | 
|---|
| 318 |     strcpy(lastfilename, filename);
 | 
|---|
| 319 |   return TRUE;
 | 
|---|
| 320 | }
 | 
|---|
| 321 | 
 | 
|---|
| 322 | BOOL export_filename(HWND hwnd, CHAR * filename, INT overwrite)
 | 
|---|
| 323 | {
 | 
|---|
| 324 |   FILEDLG fdlg;
 | 
|---|
| 325 |   FILESTATUS3 fsa;
 | 
|---|
| 326 |   CHAR drive[3], *pdrive = drive, *p;
 | 
|---|
| 327 |   static CHAR lastfilename[CCHMAXPATH] = "";
 | 
|---|
| 328 | 
 | 
|---|
| 329 |   if (!filename)
 | 
|---|
| 330 |     return FALSE;
 | 
|---|
| 331 |   memset(&fdlg, 0, sizeof(FILEDLG));
 | 
|---|
| 332 |   fdlg.cbSize = sizeof(FILEDLG);
 | 
|---|
| 333 |   fdlg.fl = FDS_CENTER | FDS_OPEN_DIALOG;
 | 
|---|
| 334 |   fdlg.pszTitle = GetPString(IDS_EXPORTNAMETITLETEXT);
 | 
|---|
| 335 |   fdlg.pszOKButton = GetPString(IDS_OKAYTEXT);
 | 
|---|
| 336 |   if (IsFullName(filename)) {
 | 
|---|
| 337 |     *drive = *filename;
 | 
|---|
| 338 |     drive[1] = ':';
 | 
|---|
| 339 |     drive[2] = 0;
 | 
|---|
| 340 |     fdlg.pszIDrive = pdrive;
 | 
|---|
| 341 |   }
 | 
|---|
| 342 |   else if (*lastfilename) {
 | 
|---|
| 343 |     *drive = *lastfilename;
 | 
|---|
| 344 |     drive[1] = ':';
 | 
|---|
| 345 |     drive[2] = 0;
 | 
|---|
| 346 |     fdlg.pszIDrive = pdrive;
 | 
|---|
| 347 |   }
 | 
|---|
| 348 |   if (!*filename) {
 | 
|---|
| 349 |     if (*lastfilename) {
 | 
|---|
| 350 |       strcpy(fdlg.szFullFile, lastfilename);
 | 
|---|
| 351 |       p = strrchr(fdlg.szFullFile, '\\');
 | 
|---|
| 352 |       if (p) {
 | 
|---|
| 353 |         p++;
 | 
|---|
| 354 |         *p = 0;
 | 
|---|
| 355 |       }
 | 
|---|
| 356 |     }
 | 
|---|
| 357 |     strcat(fdlg.szFullFile, "*.TXT");
 | 
|---|
| 358 |   }
 | 
|---|
| 359 |   else
 | 
|---|
| 360 |     strcpy(fdlg.szFullFile, filename);
 | 
|---|
| 361 | 
 | 
|---|
| 362 |   if (fCustomFileDlg) {
 | 
|---|
| 363 |     fdlg.fl |= FDS_HELPBUTTON | FDS_CUSTOM;
 | 
|---|
| 364 |     fdlg.pfnDlgProc = (PFNWP) CustomFileDlg;
 | 
|---|
| 365 |     fdlg.hMod = FM3ModHandle;
 | 
|---|
| 366 |     fdlg.usDlgId = FDLG_FRAME;
 | 
|---|
| 367 |   }
 | 
|---|
| 368 | 
 | 
|---|
| 369 |   if (WinFileDlg(HWND_DESKTOP, hwnd, &fdlg)) {
 | 
|---|
| 370 |     if (fdlg.lReturn != DID_CANCEL && !fdlg.lSRC)
 | 
|---|
| 371 |       strcpy(filename, fdlg.szFullFile);
 | 
|---|
| 372 |     else
 | 
|---|
| 373 |       return FALSE;
 | 
|---|
| 374 |   }
 | 
|---|
| 375 |   else
 | 
|---|
| 376 |     return FALSE;
 | 
|---|
| 377 |   MakeFullName(filename);
 | 
|---|
| 378 |   if (!DosQueryPathInfo(filename, FIL_STANDARD, &fsa, sizeof(fsa))) {
 | 
|---|
| 379 |     if (fsa.attrFile & FILE_DIRECTORY) {        /* device or directory */
 | 
|---|
| 380 |       saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
 | 
|---|
| 381 |              hwnd, filename, GetPString(IDS_EXISTSBUTNOTFILETEXT), filename);
 | 
|---|
| 382 |       return FALSE;
 | 
|---|
| 383 |     }
 | 
|---|
| 384 |     else if (overwrite && fsa.cbFile != 0) {
 | 
|---|
| 385 |       if (saymsg(MB_YESNO,
 | 
|---|
| 386 |                  hwnd,
 | 
|---|
| 387 |                  filename,
 | 
|---|
| 388 |                  GetPString(IDS_EXISTSERASETEXT), filename) == MBID_YES)
 | 
|---|
| 389 |         unlinkf("%s", filename);
 | 
|---|
| 390 |     }
 | 
|---|
| 391 |   }
 | 
|---|
| 392 |   p = filename;
 | 
|---|
| 393 |   while (*p) {
 | 
|---|
| 394 |     if (*p == '/')
 | 
|---|
| 395 |       *p = '\\';
 | 
|---|
| 396 |     p++;
 | 
|---|
| 397 |   }
 | 
|---|
| 398 |   if (*filename)
 | 
|---|
| 399 |     strcpy(lastfilename, filename);
 | 
|---|
| 400 |   return TRUE;
 | 
|---|
| 401 | }
 | 
|---|
| 402 | 
 | 
|---|
| 403 | #pragma alloc_text(GETNAMES,insert_filename,export_filename,CustomFileDlg)
 | 
|---|