Changeset 55630 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- May 3, 2015 6:28:17 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp
r55612 r55630 1091 1091 for (int i = argc - cNonOptions; i < argc; ++i) 1092 1092 { 1093 /* I'm sure this isn't the most effective way, but I hope it will1094 * be readable and reliable code. */1095 if (RT DirExists(argv[i]) && !RTSymlinkExists(argv[i]))1093 RTFSOBJINFO Info; 1094 int rc2 = RTPathQueryInfoEx(argv[i], &Info, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK); 1095 if (RT_SUCCESS(rc)) 1096 1096 { 1097 if (!(fFlags & VBOXSERVICETOOLBOXRMFLAG_RECURSIVE)) 1098 toolboxRmReport("Cannot remove directory '%s' as the '-R' option was not specified.\n", 1099 argv[i], true, VERR_INVALID_PARAMETER, 1100 fOutputFlags, &rc); 1097 if (RTFS_IS_SYMLINK(Info.Attr.fMode)) 1098 { 1099 rc2 = RTSymlinkDelete(argv[i], 0 /*fFlags*/); 1100 toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2, fOutputFlags, NULL); 1101 toolboxRmReport("The following error occurred while removing symlink '%s': %Rrc.\n", 1102 argv[i], RT_FAILURE(rc2), rc2, fOutputFlags, &rc); 1103 } 1104 else if (RTFS_IS_DIRECTORY(Info.Attr.fMode)) 1105 { 1106 if (!(fFlags & VBOXSERVICETOOLBOXRMFLAG_RECURSIVE)) 1107 toolboxRmReport("Cannot remove directory '%s' as the '-R' option was not specified.\n", 1108 argv[i], true, VERR_INVALID_PARAMETER, fOutputFlags, &rc); 1109 else 1110 { 1111 rc2 = RTDirRemoveRecursive(argv[i], RTDIRRMREC_F_CONTENT_AND_DIR); 1112 toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2, fOutputFlags, NULL); 1113 toolboxRmReport("The following error occurred while removing directory '%s': %Rrc.\n", 1114 argv[i], RT_FAILURE(rc2), rc2, fOutputFlags, &rc); 1115 } 1116 } 1101 1117 else 1102 1118 { 1103 int rc2 = RTDirRemoveRecursive(argv[i], 1104 RTDIRRMREC_F_CONTENT_AND_DIR); 1105 toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2, 1106 fOutputFlags, NULL); 1107 toolboxRmReport("The following error occurred while removing directory '%s': %Rrc.\n", 1108 argv[i], RT_FAILURE(rc2), rc2, 1109 fOutputFlags, &rc); 1119 rc2 = RTFileDelete(argv[i]); 1120 toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2, fOutputFlags, NULL); 1121 toolboxRmReport("The following error occurred while removing file '%s': %Rrc.\n", 1122 argv[i], RT_FAILURE(rc2), rc2, fOutputFlags, &rc); 1110 1123 } 1111 1124 } 1112 else if (RTPathExists(argv[i]) || RTSymlinkExists(argv[i])) 1113 { 1114 int rc2 = RTFileDelete(argv[i]); 1115 toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2, 1116 fOutputFlags, NULL); 1117 toolboxRmReport("The following error occurred while removing file '%s': %Rrc.\n", 1118 argv[i], RT_FAILURE(rc2), rc2, fOutputFlags, 1119 &rc); 1120 } 1125 else if ( rc2 == VERR_FILE_NOT_FOUND 1126 || rc2 == VERR_PATH_NOT_FOUND) 1127 toolboxRmReport("File '%s' does not exist (%Rrc).\n", argv[i], true, rc2, fOutputFlags, &rc); 1121 1128 else 1122 toolboxRmReport(" File '%s' does not exist.\n", argv[i],1123 true, VERR_FILE_NOT_FOUND, fOutputFlags, &rc);1129 toolboxRmReport("The following error occurred while checkin '%s' before removal: %Rrc.\n", 1130 argv[i], true, rc2, fOutputFlags, &rc); 1124 1131 } 1125 1132
Note:
See TracChangeset
for help on using the changeset viewer.