Changeset 274 for trunk/dll/valid.c
- Timestamp:
- Dec 8, 2005, 8:35:43 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/valid.c
r199 r274 16 16 01 Aug 04 SHL Rework lstrip/rstrip usage 17 17 03 Jun 05 SHL Drop CD_DEBUG logic 18 28 Nov 05 SHL MakeValidDir: correct DosQuerySysInfo args 18 19 19 20 ***********************************************************************/ … … 470 471 } 471 472 472 473 CHAR * MakeValidDir (CHAR *path) 474 { 475 CHAR drive; 476 register CHAR *p; 477 FILESTATUS3 fs; 478 APIRET status; 479 480 if(!MakeFullName(path)) { 481 if(IsValidDrive(*path)) { 482 for(;;) { 483 if(IsRoot(path)) 473 //=== MakeValidDir() build valid directory name === 474 475 CHAR *MakeValidDir(CHAR *path) 476 { 477 ULONG ulDrv; 478 CHAR *p; 479 FILESTATUS3 fs; 480 APIRET rc; 481 482 if (!MakeFullName(path)) { 483 if (IsValidDrive(*path)) { 484 // Passed name is valid - trim to directory 485 for (;;) { 486 if (IsRoot(path)) 484 487 return path; 485 488 DosError(FERR_DISABLEHARDERR); 486 status = DosQueryPathInfo(path, 487 FIL_STANDARD, 488 &fs, 489 sizeof(fs)); 490 if(!status && 491 (fs.attrFile & FILE_DIRECTORY) != 0) 489 rc = DosQueryPathInfo(path, 490 FIL_STANDARD, 491 &fs, 492 sizeof(fs)); 493 if (!rc && (fs.attrFile & FILE_DIRECTORY)) 492 494 return path; 493 495 p = strrchr(path,'\\'); 494 if (p) {495 if (p < path + 3)496 if (p) { 497 if (p < path + 3) 496 498 p++; 497 499 *p = 0; … … 502 504 } 503 505 } 506 // Fall back to boot drive 504 507 DosError(FERR_DISABLEHARDERR); 505 if (!DosQuerySysInfo(QSV_BOOT_DRIVE,506 QSV_BOOT_DRIVE,507 &drive,508 1L)) {509 drive+= '@';510 if (drive< 'C')511 drive= 'C';508 if (!DosQuerySysInfo(QSV_BOOT_DRIVE, 509 QSV_BOOT_DRIVE, 510 &ulDrv, 511 sizeof(ulDrv))) { 512 ulDrv += '@'; 513 if (ulDrv < 'C') 514 ulDrv = 'C'; 512 515 strcpy(path," :\\"); 513 *path = drive;516 *path = (CHAR)ulDrv; 514 517 } 515 518 else 516 save_dir2(path); 519 save_dir2(path); // Fall back to fm3.ini drive or current dir - should never occur 517 520 return path; 518 521 }
Note:
See TracChangeset
for help on using the changeset viewer.