|
|
1.1 root 1: /*
2: Hatari
3:
4: common file access
5: */
6:
7: #include <sys/types.h>
8: #include <sys/stat.h>
9: #include <fcntl.h>
10:
11: #include "main.h"
12: #include "dialog.h"
13: #include "file.h"
14: #include "floppy.h"
15: #include "createBlankImage.h"
16: #include "memAlloc.h"
17: #include "misc.h"
18:
19:
20: //OPENFILENAME ofn;
21: char szSTFilter[256],szROMFilter[256],szAllFilesFilter[256],szMapFileFilter[256],szYMFileFilter[256],szMemoryFileFilter[256];
22: char szCreateDiscFileName[MAX_FILENAME_LENGTH];
23: BOOL bEjectDisc,bCreateBlankDisc;
24:
25: /*-----------------------------------------------------------------------*/
26: /*
27: Initialize Windows 'Open File' dialogs
28: */
29: void File_Init(void)
30: {
31: /* FIXME */
32: /*
33: char chReplace; // string separator for szFilter
34: int i,cbString;
35:
36: // Load '*.ST' filter
37: cbString = LoadString(hInst,IDS_STRING1,szSTFilter,sizeof(szSTFilter));
38: chReplace = szSTFilter[cbString - 1]; // retrieve wildcard
39:
40: for(i=0; szSTFilter[i]!='\0'; i++) {
41: if (szSTFilter[i]==chReplace)
42: szSTFilter[i]='\0';
43: }
44: // Load '*.IMG' filter
45: cbString = LoadString(hInst,IDS_STRING2,szROMFilter,sizeof(szROMFilter));
46: chReplace = szROMFilter[cbString - 1]; // retrieve wildcard
47:
48: for(i=0; szROMFilter[i]!='\0'; i++) {
49: if (szROMFilter[i]==chReplace)
50: szROMFilter[i]='\0';
51: }
52:
53: // Load '*.*' filter
54: cbString = LoadString(hInst,IDS_STRING3,szAllFilesFilter,sizeof(szAllFilesFilter));
55: chReplace = szAllFilesFilter[cbString - 1]; // retrieve wildcard
56:
57: for(i=0; szAllFilesFilter[i]!='\0'; i++) {
58: if (szAllFilesFilter[i]==chReplace)
59: szAllFilesFilter[i]='\0';
60: }
61:
62: // Load '*.map' filter
63: cbString = LoadString(hInst,IDS_STRING4,szMapFileFilter,sizeof(szMapFileFilter));
64: chReplace = szMapFileFilter[cbString - 1]; // retrieve wildcard
65:
66: for(i=0; szMapFileFilter[i]!='\0'; i++) {
67: if (szMapFileFilter[i]==chReplace)
68: szMapFileFilter[i]='\0';
69: }
70:
71: // Load '*.ym' filter
72: cbString = LoadString(hInst,IDS_STRING5,szYMFileFilter,sizeof(szYMFileFilter));
73: chReplace = szYMFileFilter[cbString - 1]; // retrieve wildcard
74:
75: for(i=0; szYMFileFilter[i]!='\0'; i++) {
76: if (szYMFileFilter[i]==chReplace)
77: szYMFileFilter[i]='\0';
78: }
79:
80: // Load '*.mem' filter
81: cbString = LoadString(hInst,IDS_STRING6,szMemoryFileFilter,sizeof(szMemoryFileFilter));
82: chReplace = szMemoryFileFilter[cbString - 1]; // retrieve wildcard
83:
84: for(i=0; szMemoryFileFilter[i]!='\0'; i++) {
85: if (szMemoryFileFilter[i]==chReplace)
86: szMemoryFileFilter[i]='\0';
87: }
88:
89: Memory_Clear(&ofn,sizeof(OPENFILENAME));
90: ofn.lStructSize = sizeof(OPENFILENAME);
91: ofn.hInstance = hInst;
92: ofn.nMaxFile = _MAX_PATH;
93: ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT;
94: */
95: }
96:
97:
98: //-----------------------------------------------------------------------
99: /*
100: Create 'Open File' dialog, and ask user for valid filename
101: */
102: BOOL File_OpenDlg(/*HWND hWnd,*/ char *pFullFileName,int Drive)
103: {
104: /* FIXME */
105: /*
106: char szSrcDrive[_MAX_DRIVE],szSrcDir[_MAX_DIR],szSrcName[_MAX_FNAME],szSrcExt[_MAX_EXT];
107: char szTempFileName[MAX_FILENAME_LENGTH];
108: char szTempDir[MAX_FILENAME_LENGTH],szTitleString[64];
109: BOOL bRet;
110:
111: ofn.hwndOwner = hWnd;
112: ofn.lpstrFilter = szSTFilter;
113: ofn.lpstrFileTitle = NULL;
114: // Copy filename as dialog will change this(may not be valid if cancel)
115: strcpy(szTempFileName,pFullFileName);
116: // Create filename and directory of previous file
117: _splitpath(szTempFileName,szSrcDrive,szSrcDir,szSrcName,szSrcExt);
118:
119: // Filename only, save FULL path and file back here when quit
120: _makepath(szTempFileName,"","",szSrcName,szSrcExt);
121: ofn.lpstrFile = szTempFileName;
122: // Directory only
123: _makepath(szTempDir,szSrcDrive,szSrcDir,"","");
124: if (strlen(szTempDir)>0)
125: ofn.lpstrInitialDir = szTempDir;
126: else {
127: File_AddSlashToEndFileName(ConfigureParams.DiscImage.szDiscImageDirectory);
128: ofn.lpstrInitialDir = ConfigureParams.DiscImage.szDiscImageDirectory;
129: }
130: sprintf(szTitleString,"Select Disc Image for Drive '%c'",Drive+'A');
131: ofn.lpstrTitle = szTitleString;
132: ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_NOVALIDATE
133: | OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_ENABLEHOOK;// | OFN_SHOWHELP;
134: ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DIALOGBAR);
135: ofn.hInstance = hInst;
136: ofn.lpfnHook = File_OpenDlg_OFNHookProc;
137:
138: // Set globals for dialog intercept
139: bEjectDisc = bCreateBlankDisc = FALSE;
140: // Bring up dialog
141: bRet = GetOpenFileName(&ofn);
142: if (bRet)
143: strcpy(pFullFileName,szTempFileName);
144:
145: // Did we eject the disc?
146: if (bEjectDisc) {
147: // Did we have a disc inserted?
148: _splitpath(pFullFileName,szSrcDrive,szSrcDir,szSrcName,szSrcExt);
149: if ( (strlen(szSrcName)>0) || (strlen(szSrcExt)>0) ) {
150: Floppy_EjectDiscFromDrive(Drive,TRUE);
151: }
152: else {
153: MessageBox(hWnd,"There is no disc image selected for that drive - Drive is empty.",PROG_NAME,MB_OK | MB_ICONINFORMATION);
154: Floppy_EjectDiscFromDrive(Drive,FALSE);
155: }
156: // Blank disc filename, and return disc change
157: strcpy(pFullFileName,"");
158: bRet = TRUE;
159: }
160: if (bCreateBlankDisc) {
161: // Do dialog for disc create, filename is in 'szCreateDiscFileName'
162: if (CreateBlankImage_DoDialog(hWnd,Drive,szCreateDiscFileName)) {
163: // Copy filename, so auto-inserts into drive
164: strcpy(pFullFileName,szCreateDiscFileName);
165: }
166: }
167:
168: return(bRet);
169: */
170: return TRUE;
171: }
172:
173: //-----------------------------------------------------------------------
174: /*
175: Create 'Open File' dialog, don't have extra buttons via hook
176: */
177: /*
178: BOOL File_OpenDlg_NoExtraButtons(HWND hWnd, char *pFullFileName)
179: {
180: char szSrcDrive[_MAX_DRIVE],szSrcDir[_MAX_DIR],szSrcName[_MAX_FNAME],szSrcExt[_MAX_EXT];
181: char szTempFileName[MAX_FILENAME_LENGTH];
182: char szTempDir[MAX_FILENAME_LENGTH],szTitleString[64];
183: BOOL bRet;
184:
185: ofn.hwndOwner = hWnd;
186: ofn.lpstrFilter = szSTFilter;
187: ofn.lpstrFileTitle = NULL;
188: // Copy filename as dialog will change this(may not be valid if cancel)
189: strcpy(szTempFileName,pFullFileName);
190: // Create filename and directory of previous file
191: _splitpath(szTempFileName,szSrcDrive,szSrcDir,szSrcName,szSrcExt);
192:
193: // Filename only, save FULL path and file back here when quit
194: _makepath(szTempFileName,"","",szSrcName,szSrcExt);
195: ofn.lpstrFile = szTempFileName;
196: // Directory only
197: _makepath(szTempDir,szSrcDrive,szSrcDir,"","");
198: if (strlen(szTempDir)>0)
199: ofn.lpstrInitialDir = szTempDir;
200: else {
201: File_AddSlashToEndFileName(ConfigureParams.DiscImage.szDiscImageDirectory);
202: ofn.lpstrInitialDir = ConfigureParams.DiscImage.szDiscImageDirectory;
203: }
204: sprintf(szTitleString,"Select Disc Image");
205: ofn.lpstrTitle = szTitleString;
206: ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_NOVALIDATE | OFN_EXPLORER;
207: ofn.lpTemplateName = NULL;
208: ofn.hInstance = hInst;
209: ofn.lpfnHook = File_OpenDlg_OFNHookProc;
210:
211: // Bring up dialog
212: bRet = GetOpenFileName(&ofn);
213: if (bRet)
214: strcpy(pFullFileName,szTempFileName);
215:
216: return(bRet);
217: }
218: */
219:
220: //-----------------------------------------------------------------------
221: /*
222: Create 'Browse' dialog, and ask user for valid directory
223: */
224: /*
225: BOOL File_OpenBrowseDlg(HWND hWnd, char *pFullFileName,BOOL bTosROM,BOOL bFileMustExist)
226: {
227: char szChosenPath[MAX_PATH];
228: BROWSEINFO bInfo;
229: LPITEMIDLIST idList;
230:
231: bInfo.hwndOwner = hWnd;
232: bInfo.pidlRoot = NULL;
233: bInfo.pszDisplayName = szChosenPath;
234: bInfo.lpszTitle = "Select a directory:";
235: bInfo.lpfn = NULL;
236: bInfo.ulFlags = 0;
237: bInfo.lParam = 0;
238: bInfo.iImage = 0;
239:
240: idList = SHBrowseForFolder(&bInfo);
241: if (idList != NULL) {
242: if (SHGetPathFromIDList(idList, szChosenPath)) {
243: strcpy(pFullFileName,szChosenPath);
244: return(TRUE);
245: }
246: }
247:
248: return(FALSE);
249: }
250: */
251:
252: //-----------------------------------------------------------------------
253: /*
254: Create 'Open File' dialog, and ask user for TOS image filename
255: */
256: BOOL File_OpenSelectDlg(/*HWND hWnd,*/ char *pFullFileName,int FileFilter,BOOL bFileMustExist,BOOL bSaving)
257: {
258: /* FIXME */
259: /*
260: char szSrcDrive[_MAX_DRIVE],szSrcDir[_MAX_DIR],szSrcName[_MAX_FNAME],szSrcExt[_MAX_EXT];
261: char szTempDir[MAX_FILENAME_LENGTH];
262:
263: ofn.hwndOwner = hWnd;
264: switch (FileFilter) {
265: case FILEFILTER_DISCFILES:
266: ofn.lpstrFilter = szSTFilter;
267: ofn.lpstrTitle = "Select Disc Image";
268: break;
269: case FILEFILTER_TOSROM:
270: ofn.lpstrFilter = szROMFilter;
271: ofn.lpstrTitle = "Select TOS Image";
272: break;
273: case FILEFILTER_MAPFILE:
274: ofn.lpstrFilter = szMapFileFilter;
275: ofn.lpstrTitle = "Select Keyboard Map file";
276: break;
277: case FILEFILTER_YMFILE:
278: ofn.lpstrFilter = szYMFileFilter;
279: ofn.lpstrTitle = "Select YM or WAV file";
280: break;
281: case FILEFILTER_MEMORYFILE:
282: ofn.lpstrFilter = szMemoryFileFilter;
283: ofn.lpstrTitle = "Select Memory Capture file";
284: break;
285:
286: default:
287: ofn.lpstrFilter = szAllFilesFilter;
288: ofn.lpstrTitle = NULL;
289: break;
290: }
291: ofn.lpstrFileTitle = NULL;
292: // Create filename and directory of previous file
293: _splitpath(pFullFileName,szSrcDrive,szSrcDir,szSrcName,szSrcExt);
294:
295: // Filename only, save FULL path and file back here when quit
296: _makepath(pFullFileName,"","",szSrcName,szSrcExt);
297: ofn.lpstrFile = pFullFileName;
298: // Directory only
299: _makepath(szTempDir,szSrcDrive,szSrcDir,"","");
300: ofn.lpstrInitialDir = szTempDir;
301: if (bFileMustExist)
302: ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
303: else
304: ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
305: ofn.lpTemplateName = MAKEINTRESOURCE(1536);
306:
307: if (bSaving)
308: return GetSaveFileName(&ofn);
309: else
310: return GetOpenFileName(&ofn);
311: */
312: }
313:
1.1.1.2 ! root 314:
! 315: /*-----------------------------------------------------------------------*/
1.1 root 316: /*
317: Remove any '/'s from end of filenames, but keeps / intact
318: */
319: void File_CleanFileName(char *pszFileName)
320: {
321: char szString[MAX_FILENAME_LENGTH];
322: int i=0,j=0;
323:
1.1.1.2 ! root 324: /* Remove end slash from filename! But / remains! Doh! */
1.1 root 325: if( strlen(pszFileName)>2 && pszFileName[strlen(pszFileName)-1]=='/' )
326: pszFileName[strlen(pszFileName)-1]=0;
327: }
328:
1.1.1.2 ! root 329:
! 330: /*-----------------------------------------------------------------------*/
1.1 root 331: /*
332: Add '/' to end of filename
333: */
334: void File_AddSlashToEndFileName(char *pszFileName)
335: {
1.1.1.2 ! root 336: /* Check dir/filenames */
1.1 root 337: if (strlen(pszFileName)!=0) {
338: if (pszFileName[strlen(pszFileName)-1]!='/')
1.1.1.2 ! root 339: strcat(pszFileName,"/"); /* Must use end slash */
1.1 root 340: }
341: }
342:
343: /*-----------------------------------------------------------------------*/
344: /*
345: Does filename extension match? If so, return TRUE
346: */
347: BOOL File_DoesFileExtensionMatch(char *pszFileName, char *pszExtension)
348: {
349: if ( strlen(pszFileName) < strlen(pszExtension) )
350: return(FALSE);
351: /* Is matching extension? */
352: if ( !strcasecmp(&pszFileName[strlen(pszFileName)-strlen(pszExtension)], pszExtension) )
353: return(TRUE);
354:
355: /* No */
356: return(FALSE);
357: }
358:
1.1.1.2 ! root 359:
! 360: /*-----------------------------------------------------------------------*/
1.1 root 361: /*
362: Check if filename is from root
363:
364: Return TRUE if filename is '/', else give FALSE
365: */
366: BOOL File_IsRootFileName(char *pszFileName)
367: {
368: if (pszFileName[0]=='\0') /* If NULL string return! */
369: return(FALSE);
370:
371: if (pszFileName[0]=='/')
372: return(TRUE);
373:
374: return(FALSE);
375: }
376:
1.1.1.2 ! root 377:
! 378: /*-----------------------------------------------------------------------*/
1.1 root 379: /*
380: Return string, to remove 'C:' part of filename
381: */
382: char *File_RemoveFileNameDrive(char *pszFileName)
383: {
384: if ( (pszFileName[0]!='\0') && (pszFileName[1]==':') )
385: return(&pszFileName[2]);
386: else
387: return(pszFileName);
388: }
389:
390:
1.1.1.2 ! root 391: /*-----------------------------------------------------------------------*/
1.1 root 392: /*
393: Check if filename end with a '/'
394:
395: Return TRUE if filename ends with '/'
396: */
397: BOOL File_DoesFileNameEndWithSlash(char *pszFileName)
398: {
399: if (pszFileName[0]=='\0') /* If NULL string return! */
400: return(FALSE);
401:
1.1.1.2 ! root 402: /* Does string end in a '\'? */
1.1 root 403: if (pszFileName[strlen(pszFileName)-1]=='/')
404: return(TRUE);
405:
406: return(FALSE);
407: }
408:
1.1.1.2 ! root 409:
! 410: /*-----------------------------------------------------------------------*/
1.1 root 411: /*
412: Remove any double '/'s from end of filenames. So just the one
413: */
414: void File_RemoveFileNameTrailingSlashes(char *pszFileName)
415: {
416: int Length;
417:
418: /* Do have slash at end of filename? */
419: Length = strlen(pszFileName);
420: if (Length>=3) {
421: if (pszFileName[Length-1]=='/') { /* Yes, have one previous? */
422: if (pszFileName[Length-2]=='/')
423: pszFileName[Length-1] = '\0'; /* then remove it! */
424: }
425: }
426: }
427:
428:
1.1.1.2 ! root 429: /*-----------------------------------------------------------------------*/
1.1 root 430: /*
431: Does filename end with a .MSA extension? If so, return TRUE
432: */
433: BOOL File_FileNameIsMSA(char *pszFileName)
434: {
435: return(File_DoesFileExtensionMatch(pszFileName,".msa"));
436: }
437:
1.1.1.2 ! root 438:
! 439: /*-----------------------------------------------------------------------*/
1.1 root 440: /*
441: Does filename end with a .ST extension? If so, return TRUE
442: */
443: BOOL File_FileNameIsST(char *pszFileName)
444: {
445: return(File_DoesFileExtensionMatch(pszFileName,".st"));
446: }
447:
448:
1.1.1.2 ! root 449: /*-----------------------------------------------------------------------*/
1.1 root 450: /*
1.1.1.2 ! root 451: Read file from PC into memory, allocate memory for it if need to (pass Address as NULL)
! 452: Also may pass 'unsigned long' if want to find size of file read (may pass as NULL)
1.1 root 453: */
454: void *File_Read(char *pszFileName, void *pAddress, long *pFileSize, char *ppszExts[])
455: {
1.1.1.2 ! root 456: FILE *DiscFile;
1.1 root 457: void *pFile=NULL;
458: long FileSize=0;
459:
460: /* Does the file exist? If not, see if can scan for other extensions and try these */
461: if (!File_Exists(pszFileName) && ppszExts) {
462: /* Try other extensions, if suceeds correct filename is now in 'pszFileName' */
463: File_FindPossibleExtFileName(pszFileName,ppszExts);
464: }
465:
466: /* Open our file */
1.1.1.2 ! root 467: DiscFile = fopen(pszFileName, "rb");
! 468: if (DiscFile!=NULL) {
1.1 root 469: /* Find size of TOS image - 192k or 256k */
1.1.1.2 ! root 470: fseek(DiscFile, 0, SEEK_END);
! 471: FileSize = ftell(DiscFile);
! 472: fseek(DiscFile, 0, SEEK_SET);
1.1 root 473: /* Find pointer to where to load, allocate memory if pass NULL */
474: if (pAddress)
475: pFile = pAddress;
476: else
477: pFile = Memory_Alloc(FileSize);
478: /* Read in... */
479: if (pFile)
1.1.1.2 ! root 480: fread((char *)pFile, 1, FileSize, DiscFile);
1.1 root 481:
1.1.1.2 ! root 482: fclose(DiscFile);
1.1 root 483: }
1.1.1.2 ! root 484: /* Store size of file we read in (or 0 if failed) */
1.1 root 485: if (pFileSize)
486: *pFileSize = FileSize;
487:
488: return(pFile); /* Return to where read in/allocated */
489: }
490:
1.1.1.2 ! root 491:
! 492: /*-----------------------------------------------------------------------*/
1.1 root 493: /*
494: Save file to PC, return FALSE if errors
495: */
496: BOOL File_Save(char *pszFileName, void *pAddress,long Size,BOOL bQueryOverwrite)
497: {
1.1.1.2 ! root 498: FILE *DiscFile;
1.1 root 499: BOOL bRet=FALSE;
500:
501: /* Check if need to ask user if to overwrite */
502: if (bQueryOverwrite) {
503: /* If file exists, ask if OK to overwrite */
504: if (!File_QueryOverwrite(pszFileName))
505: return(FALSE);
506: }
507:
508: /* Create our file */
1.1.1.2 ! root 509: DiscFile = fopen(pszFileName, "wb");
! 510: if (DiscFile!=NULL) {
1.1 root 511: /* Write data, set success flag */
1.1.1.2 ! root 512: if ( fwrite(pAddress, 1, Size, DiscFile)==Size )
1.1 root 513: bRet = TRUE;
514:
1.1.1.2 ! root 515: fclose(DiscFile);
1.1 root 516: }
517:
518: return(bRet);
519: }
520:
1.1.1.2 ! root 521:
! 522: /*-----------------------------------------------------------------------*/
1.1 root 523: /*
524: Return size of file, -1 if error
525: */
526: int File_Length(char *pszFileName)
527: {
528: int DiscFile;
529: int FileSize;
530:
531: /* Attempt to open file(with OF_EXIST) */
532: DiscFile = open(pszFileName, O_RDONLY);
533: if (DiscFile>=0) {
534: /* Find length */
535: FileSize = lseek(DiscFile,0,SEEK_END);
536: close(DiscFile);
537:
538: return(FileSize);
539: }
540:
541: return(-1);
542: }
543:
1.1.1.2 ! root 544:
! 545: /*-----------------------------------------------------------------------*/
1.1 root 546: /*
547: Return TRUE if file exists
548: */
549: BOOL File_Exists(char *pszFileName)
550: {
551: int DiscFile;
552:
1.1.1.2 ! root 553: /* Attempt to open file */
1.1 root 554: DiscFile = open(pszFileName, O_RDONLY);
1.1.1.2 ! root 555: if (DiscFile!=-1) {
! 556: close(DiscFile);
1.1 root 557: return(TRUE);
1.1.1.2 ! root 558: }
1.1 root 559: return(FALSE);
560: }
561:
1.1.1.2 ! root 562:
! 563: /*-----------------------------------------------------------------------*/
1.1 root 564: /*
565: Delete file, return TRUE if OK
566: */
567: BOOL File_Delete(char *pszFileName)
568: {
1.1.1.2 ! root 569: /* Delete the file (must be closed first) */
1.1 root 570: return( remove(pszFileName) );
571: }
572:
1.1.1.2 ! root 573:
! 574: /*-----------------------------------------------------------------------*/
1.1 root 575: /*
576: Find if file exists, and if so ask user if OK to overwrite
577: */
1.1.1.2 ! root 578: BOOL File_QueryOverwrite(char *pszFileName)
1.1 root 579: {
580:
581: char szString[MAX_FILENAME_LENGTH];
582:
1.1.1.2 ! root 583: /* Try and find if file exists */
1.1 root 584: if (File_Exists(pszFileName)) {
1.1.1.2 ! root 585: /* File does exist, are we OK to overwrite? */
1.1 root 586: sprintf(szString,"File '%s' exists, overwrite?",pszFileName);
587: /* FIXME: */
588: // if (MessageBox(hWnd,szString,PROG_NAME,MB_YESNO | MB_DEFBUTTON2 | MB_ICONSTOP)==IDNO)
589: // return(FALSE);
590: }
591:
592: return(TRUE);
593: }
594:
1.1.1.2 ! root 595:
! 596: /*-----------------------------------------------------------------------*/
1.1 root 597: /*
598: Try filename with various extensions and check if file exists - if so return correct name
599: */
600: BOOL File_FindPossibleExtFileName(char *pszFileName,char *ppszExts[])
601: {
602: /* FIXME */
603: /*
604: char szSrcDrive[_MAX_DRIVE],szSrcDir[_MAX_DIR],szSrcName[_MAX_FNAME],szSrcExt[_MAX_EXT];
605: char szTempFileName[MAX_FILENAME_LENGTH];
606: int i=0;
607:
608: // Split filename into parts
609: _splitpath(pszFileName,szSrcDrive,szSrcDir,szSrcName,szSrcExt);
610:
611: // Scan possible extensions
612: while(ppszExts[i]) {
613: // Re-build with new file extension
614: _makepath(szTempFileName,szSrcDrive,szSrcDir,szSrcName,ppszExts[i]);
615: // Does this file exist?
616: if (File_Exists(szTempFileName)) {
617: // Copy name for return
618: strcpy(pszFileName,szTempFileName);
619: return(TRUE);
620: }
621:
622: // Next one
623: i++;
624: }
625: */
1.1.1.2 ! root 626: /* No, none of the files exist */
1.1 root 627: return(FALSE);
628: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.