Changeset 1686 for trunk/dll/copyf.c
- Timestamp:
- Mar 10, 2013, 7:34:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/copyf.c
r1664 r1686 33 33 04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog for delete of 34 34 readonly files 35 10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options 35 36 36 37 ***********************************************************************/ … … 531 532 DosError(FERR_DISABLEHARDERR); 532 533 if (DosDeleteDir(dir)) { 533 make_deleteable(dir, 0);534 make_deleteable(dir, -1, TRUE); 534 535 DosDeleteDir(dir); 535 536 } … … 541 542 error = DosForceDelete(dir); 542 543 if (error) { 543 make_deleteable(dir, error );544 make_deleteable(dir, error, FALSE); 544 545 DosForceDelete(dir); 545 546 } … … 618 619 DosError(FERR_DISABLEHARDERR); 619 620 if (DosDeleteDir(oldname)) { 620 make_deleteable(oldname, 0);621 make_deleteable(oldname, -1, TRUE); 621 622 DosDeleteDir(oldname); 622 623 } … … 675 676 } 676 677 677 INT make_deleteable(CHAR * filename, INT error )678 INT make_deleteable(CHAR * filename, INT error, BOOL Dontcheckreadonly) 678 679 { 679 680 APIRET rc; … … 682 683 FILESTATUS3 fsi; 683 684 685 //DbgMsg(pszSrcFile, __LINE__, "error %i ", error); 686 DosError(FERR_DISABLEHARDERR); 687 rc = DosQueryPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi)); 688 if (!rc) { 689 if (fsi.attrFile & 0x00000001) { 690 if (fWarnReadOnly && !Dontcheckreadonly) { 691 retrn = saymsg2(NULL, 0, 692 HWND_DESKTOP, 693 GetPString(IDS_READONLYFILEWARNINGTITLE), 694 GetPString(IDS_READONLYFILEWARNING), 695 filename); 696 if (retrn == 3) 697 ret = 3; 698 else if (retrn == 4) 699 ret = 2; 700 else { 701 fsi.attrFile = 0; 702 DosError(FERR_DISABLEHARDERR); 703 if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0)) 704 if (retrn == 1) 705 ret = 0; 706 else 707 ret = 1; 708 } 709 } 710 else 711 fsi.attrFile = 0; 712 DosError(FERR_DISABLEHARDERR); 713 if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0)) 714 ret = 0; 715 } 716 } 684 717 if (error == ERROR_SHARING_VIOLATION && fUnlock) { 685 718 retrn = saymsg(MB_YESNO | MB_DEFBUTTON2, … … 694 727 } 695 728 } 696 DosError(FERR_DISABLEHARDERR);697 rc = DosQueryPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi));698 if (!rc) {699 if (fsi.attrFile & 0x00000001) {700 if (fWarnReadOnly && error != -1) {701 retrn = saymsg(MB_YESNO | MB_DEFBUTTON2,702 HWND_DESKTOP,703 GetPString(IDS_READONLYFILEWARNINGTITLE),704 GetPString(IDS_READONLYFILEWARNING),705 filename);706 if (retrn == MBID_YES) {707 fsi.attrFile = 0;708 DosError(FERR_DISABLEHARDERR);709 if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0))710 ret = 0;711 }712 else713 ret = 0;714 }715 else716 fsi.attrFile = 0;717 DosError(FERR_DISABLEHARDERR);718 if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0))719 ret = 0;720 }721 }722 729 723 730 return ret; … … 737 744 va_list ap; 738 745 INT rc; 746 static BOOL ignorereadonly = FALSE; 739 747 740 748 va_start(ap, string); … … 815 823 // remove directory 816 824 if (DosDeleteDir(ss)) { 817 make_deleteable(ss, 0); // Try harder825 make_deleteable(ss, -1, TRUE); // Try harder 818 826 DosError(FERR_DISABLEHARDERR); 819 827 DosDeleteDir(ss); … … 826 834 DosError(FERR_DISABLEHARDERR); 827 835 error = DosForceDelete(ss); 828 if (error) { 829 make_deleteable(ss, error); 836 if (error) { 837 INT retrn = 0; 838 839 retrn = make_deleteable(ss, error, ignorereadonly); 840 if (retrn == 3) 841 continue; 842 else if (retrn == 1) 843 ignorereadonly = TRUE; 830 844 DosError(FERR_DISABLEHARDERR); 831 845 rc = (INT) DosForceDelete(ss); … … 844 858 free(ss); 845 859 free(str); 860 ignorereadonly = FALSE; 846 861 return 0; 847 862 } … … 930 945 DosError(FERR_DISABLEHARDERR); 931 946 if (DosDelete(string)) { 932 make_deleteable(string, -1 );947 make_deleteable(string, -1, TRUE); 933 948 DosError(FERR_DISABLEHARDERR); 934 949 return DosDelete(string); … … 941 956 error = DosForceDelete(string); 942 957 if (error) { 943 make_deleteable(string, error );958 make_deleteable(string, error, FALSE); 944 959 DosError(FERR_DISABLEHARDERR); 945 960 return DosForceDelete(string);
Note:
See TracChangeset
for help on using the changeset viewer.