Changeset 50615 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Feb 26, 2014 6:29:01 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/tools/RTDbgSymCache.cpp
r49118 r50615 73 73 { 74 74 bool fRecursive; 75 bool fOverwriteOnConflict; 75 76 const char *pszFilter; 76 77 const char *pszCache; … … 172 173 { 173 174 if (!pszCommand || !strcmp(pszCommand, "add")) 174 RTPrintf("Usage: %s add [- rn] <cache-root-dir> <file1> [fileN..]\n", pszArg0);175 RTPrintf("Usage: %s add [-Rno] <cache-root-dir> <file1> [fileN..]\n", pszArg0); 175 176 return RTEXITCODE_SUCCESS; 176 177 } … … 372 373 else 373 374 RTMsgInfo("Error comparing '%s' with '%s': %Rrc", pszSrcPath, szDstPath, rc); 374 return rc; 375 if (!pCfg->fOverwriteOnConflict) 376 return rc; 375 377 } 376 378 … … 746 748 static char const * const s_apszSubBundleDirs[] = 747 749 { 748 "Contents/Plugins ",750 "Contents/Plugins/", 749 751 /** @todo Frameworks ++ */ 750 752 }; … … 752 754 { 753 755 pszPath[cchPath + cchName] = '\0'; 754 int rc2 = RTPathAppend(pszPath, RTPATH_MAX , s_apszSubBundleDirs[i]);756 int rc2 = RTPathAppend(pszPath, RTPATH_MAX - 1, s_apszSubBundleDirs[i]); 755 757 if (RT_SUCCESS(rc2)) 756 rc2 = rtDbgSymCacheAddDirWorker(pszPath, strlen(pszPath), pDirEntry, pCfg); 758 { 759 if (RTDirExists(pszPath)) 760 { 761 size_t cchPath2 = strlen(pszPath); 762 if (!RTPATH_IS_SLASH(pszPath[cchPath2 - 1])) 763 { 764 pszPath[cchPath2++] = RTPATH_SLASH; 765 pszPath[cchPath2] = '\0'; 766 } 767 rc2 = rtDbgSymCacheAddDirWorker(pszPath, cchPath2, pDirEntry, pCfg); 768 } 769 } 757 770 else 758 771 { … … 1087 1100 * 1088 1101 * @returns Program exit code. 1089 * @param pszPath The user supplied path to the file or directory. 1090 * @param pszCache The path to the cache. 1091 * @param fRecursive Whether to process directories recursively. 1092 */ 1093 static RTEXITCODE rtDbgSymCacheAddFileOrDir(const char *pszPath, const char *pszCache, bool fRecursive) 1102 * @param pszPath The user supplied path to the file or directory. 1103 * @param pszCache The path to the cache. 1104 * @param fRecursive Whether to process directories recursively. 1105 * @param fOverwriteOnConflict Whether to overwrite existing cache entry on 1106 * conflict, or just leave it. 1107 */ 1108 static RTEXITCODE rtDbgSymCacheAddFileOrDir(const char *pszPath, const char *pszCache, bool fRecursive, 1109 bool fOverwriteOnConflict) 1094 1110 { 1095 1111 RTDBGSYMCACHEADDCFG Cfg; … … 1166 1182 static RTGETOPTDEF const s_aOptions[] = 1167 1183 { 1168 { "--recursive", 'R', RTGETOPT_REQ_NOTHING }, 1169 { "--no-recursive", 'n', RTGETOPT_REQ_NOTHING }, 1184 { "--recursive", 'R', RTGETOPT_REQ_NOTHING }, 1185 { "--no-recursive", 'n', RTGETOPT_REQ_NOTHING }, 1186 { "--overwrite-on-conflict", 'o', RTGETOPT_REQ_NOTHING }, 1170 1187 }; 1171 1188 1172 const char *pszCache = NULL; 1173 bool fRecursive = false; 1189 const char *pszCache = NULL; 1190 bool fRecursive = false; 1191 bool fOverwriteOnConflict = false; 1174 1192 1175 1193 RTGETOPTSTATE State; … … 1191 1209 case 'n': 1192 1210 fRecursive = false; 1211 break; 1212 1213 case 'o': 1214 fOverwriteOnConflict = true; 1193 1215 break; 1194 1216 … … 1210 1232 else 1211 1233 { 1212 RTEXITCODE rcExit = rtDbgSymCacheAddFileOrDir(ValueUnion.psz, pszCache, fRecursive );1234 RTEXITCODE rcExit = rtDbgSymCacheAddFileOrDir(ValueUnion.psz, pszCache, fRecursive, fOverwriteOnConflict); 1213 1235 if (rcExit != RTEXITCODE_FAILURE) 1214 1236 return rcExit;
Note:
See TracChangeset
for help on using the changeset viewer.