void UploadResumeThread::doRun() { assert(m_pUpInfo); getWebCore()->resumeUpload(getItemId(), m_szKey.c_str(), *m_pUpInfo); const char* localFilePath = getUploadManager()->findUpload(m_szKey.c_str()); gcString sLocalFP(localFilePath); if (localFilePath && validFile(localFilePath)) { onCompleteStrEvent(sLocalFP); return; } //gona try and search for the file in the data/mods/id folder const char* appDataPath = getUserCore()->getAppDataPath(); gcString searchPath("{0}{1}{2}", appDataPath, DIRS_STR, getItemId().getFolderPathExtension()); gcString sNull("NULL"); if (doSearch(searchPath.c_str())) return; if (getUserCore()->isAdmin()) { searchPath = gcString("{0}{1}temp{1}", appDataPath, DIRS_STR); if (doSearch(searchPath.c_str())) return; } onCompleteStrEvent(sNull); }
MachOChecker<A>::MachOChecker(const uint8_t* fileContent, uint32_t fileLength, const char* path) : fHeader(NULL), fLength(fileLength), fStrings(NULL), fSymbols(NULL), fSymbolCount(0), fIndirectTableCount(0), fLocalRelocations(NULL), fLocalRelocationsCount(0), fExternalRelocations(NULL), fExternalRelocationsCount(0), fRelocBase(0), fWriteableSegmentWithAddrOver4G(false), fFirstSegment(NULL), fFirstWritableSegment(NULL) { // sanity check if ( ! validFile(fileContent) ) throw "not a mach-o file that can be checked"; fPath = strdup(path); fHeader = (const macho_header<P>*)fileContent; // sanity check header checkMachHeader(); // check load commands checkLoadCommands(); checkIndirectSymbolTable(); checkRelocations(); }
bool UploadResumeThread::doSearch(const char* path) { if (!path) return false; std::vector<UTIL::FS::Path> fileList; std::vector<std::string> extList; extList.push_back("mcf"); UTIL::FS::getAllFiles(UTIL::FS::PathWithFile(path), fileList, &extList); for (size_t x=0; x<fileList.size(); x++) { if (validFile(fileList[x].getFullPath().c_str())) { gcString fullPath = fileList[x].getFullPath(); onCompleteStrEvent(fullPath); return true; } } return false; }