/* returns 0 if ok, error code otherwise */ static int extract(int argc, char **argv) { int strip, verbose, test, err, non, noff, doc = 0, page = 0; char *marker, s[MAXLINE], start[MAXLINE]; FILE *fpin, *fpout; /* unused variables int cont = 1; char *t[MAXLINE]; */ verbose = existFlag(argc, argv, VERBFLAG); if (verbose) banner(); err = getFiles(argc, argv, &fpin, &fpout, strip = existFlag(argc, argv, REVFLAG)); if (err) return err; strcpy(start, STARTDOC); marker = getFlagName(argc, argv, MARKFLAG); strcat(start, marker == NULL ? AUTODOC : marker); non = strlen(start); noff = strlen(ENDDOC); test = (!strip) && existFlag(argc, argv, TESTFLAG); if (test) preamble(fpout); while (fgets(s, MAXLINE, fpin) != NULL) doc = stripdoc(fpout,s,start,doc,non,noff,verbose,strip,&page); if (test) closing(fpout); if (verbose) fputc('\n', stderr); fclose(fpin); fclose(fpout); return 0; }
KITTI::KITTI(int sequence, int max, int startOffset) : sequence(sequence) , startOffset(startOffset) { std::stringstream ss; ss << std::setw(2) << std::setfill('0') << sequence; std::string seq_prefix = ss.str(); path_to_image_0 = "/home/sebastian/Dropbox/KITTI/sequences/" + seq_prefix + "/image_0/"; path_to_image_2 = "/home/sebastian/Dropbox/KITTI/sequences/" + seq_prefix + "/image_2/"; path_to_velo = "/home/sebastian/Dropbox/KITTI/velo/" + seq_prefix; pathPoses = "/home/sebastian/Dropbox/KITTI/poses/" + seq_prefix + ".txt"; result_dir = "/home/sebastian/Dropbox/KITTI/results"; getFiles(path_to_velo, velo_files); if (max > velo_files.size()) velo_files.resize(velo_files.size()); else velo_files.resize(max); velo_files.erase(velo_files.begin(), velo_files.begin() + startOffset); getFiles(path_to_image_0, image_0_files); width = 1240; height = 376; seq_size = startOffset + velo_files.size(); getGtCameraPoses(gt_T); if (max > gt_T.size()) gt_T.resize(gt_T.size() -1); else gt_T.resize(max); gt_T.erase(gt_T.begin(), gt_T.begin() + startOffset); }
void loadModels(const std::string& dir) { model.load(dir + "tris.md2"); Array<std::string> weaponFilename; getFiles(dir + "w_*.md2", weaponFilename); getFiles(dir + "weapon.md2", weaponFilename); weapon.load(dir + weaponFilename.last()); }
void identify_shu() { // string probe = "010_s1"; random_1=rand() % 21; random_2=rand() % 5; string canonical = "001_s1"; string probe = ppl_no[random_1]+"_"+ppl_set[random_2]; string rgbPath = "/Users/rydge/desktop/Current/BS/shu_face/rgb/"; string rgbProbe = rgbPath + "/" + probe + ".bmp"; string path = "/Users/rydge/desktop/Current/BS/shu_face/aligned/" + canonical + "/"; string depthResult; string rgbResult; vector<string> depthFiles,rgbFiles; double distance_tmp, distance_min = 1000000; getFiles(path, depthFiles); getFiles(rgbPath, rgbFiles); size_t size = depthFiles.size(); vector<Point3D> target; string targetPath = path + probe + " - " + canonical + ".txt"; shuReadPoints(targetPath.c_str(), target); showRGB(rgbProbe,"Probe Face"); clock_t start,finish; start=clock(); for (int i = 0; i < size; i++) { vector<Point3D> source, mark; shuReadPoints((path+depthFiles[i]).c_str(), source); cout << "源文件: "<< depthFiles[i].c_str() << endl; distance_tmp = calculate(source, target); cout << "欧氏距离: " << distance_tmp << endl; if (distance_tmp < distance_min && distance_tmp > 0) { distance_min = distance_tmp; depthResult = depthFiles[i]; rgbResult = rgbFiles[i]; } showRGB_temp(rgbPath+rgbFiles[i],"Searching..."); } finish=clock(); total_time+=(double)(finish-start)/CLOCKS_PER_SEC; cout<<"||-----识别所花时间为:"<<total_time<<"s-----||"<<endl; cout << "识别脸深度文件为:"<< depthResult.c_str() << endl << distance_min << endl; cout << "识别脸RGB文件为:" << rgbResult.c_str() << endl; showRGB(rgbPath+rgbResult, "Result Face"); };
void AaptDir::print() const { const size_t ND=getDirs().size(); size_t i; for (i=0; i<ND; i++) { getDirs().valueAt(i)->print(); } const size_t NF=getFiles().size(); for (i=0; i<NF; i++) { getFiles().valueAt(i)->print(); } }
FtpApp::FtpApp() { manager = new QNetworkAccessManager(this); setWindowTitle("JIGS File Sharing"); setGeometry(430,300,555,400); QMovie *movie = new QMovie(":/images/waiting.gif"); processLabel = new QLabel(this); processLabel->setMovie(movie); movie->start(); splash = new QSplashScreen; splash->setPixmap(QPixmap(":/images/FtpSplash.png")); splash->show(); createStatusBar(); createActions(); createMenus(); fileList = new QTreeWidget; fileList->setEnabled(false); fileList->setRootIsDecorated(false); fileList->setHeaderLabels(QStringList() << tr("Name") << tr("Size") << tr("Owner") << tr("Group") << tr("Time")); fileList->setColumnWidth(0,150); connect(fileList,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this,SLOT(downloadFile(QTreeWidgetItem*))); getFiles(); }
PathButton::PathButton(QWidget *parent) : QPushButton(parent), d(new Data) { QPushButton::setText(d->getText()); connect(this, &QPushButton::clicked, this, [=] () { switch (d->mode) { case Folder: { const auto ret = getFolder(); if (!ret.isEmpty()) { emit folderSelected(ret); if (d->editor) d->prop.write(d->editor, ret); } break; } case SingleFile: { const auto ret = getFile(); if (!ret.isEmpty()) { emit fileSelected(ret); if (d->editor) d->prop.write(d->editor, ret); } break; } case MultiFile: { const auto ret = getFiles(); if (!ret.isEmpty()) { emit filesSelected(ret); if (d->editor) d->prop.write(d->editor, ret); } } default: break; } }); }
int main(int argc, char *argv[]) { queueEntry *root = getFiles(); printList(root); deleteEntries(root); return 0; }
static bool maybeAddDirectory(const std::string& newPath, Array<Directory>& directoryArray, bool recurse = true) { if (fileExists(newPath)) { Directory& d = directoryArray.next(); d.path = newPath; getFiles(pathConcat(newPath, "*"), d.contents); Array<std::string> dirs; getDirs(pathConcat(newPath, "*"), dirs); d.contents.append(dirs); if (recurse) { // Look for subdirectories static const std::string subdirs[] = {"font", "gui", "SuperShader", "cubemap", "icon", "material", "image", "md2", "md3", "ifs", "3ds", "sky", ""}; for (int j = 0; j < dirs.size(); ++j) { for (int i = 0; ! subdirs[i].empty(); ++i) { if (dirs[j] == subdirs[i]) { maybeAddDirectory(pathConcat(newPath, dirs[j]), directoryArray, false); } } } } return true; } else { return false; } }
ToolVersion BasementJob::getToolVersionImpl(const std::string &t_toolName) const { if (t_toolName != "basement") { throw std::runtime_error("Invalid tool version request: " + t_toolName); } Files f = allInputFiles(); getFiles(f); // Start at the currently configured minor version. ToolVersion tv(energyPlusVersionMajor(),energyPlusVersionMinor(),energyPlusVersionPatch(),energyPlusBuildSHA()); if (m_expandedidf){ if (boost::filesystem::exists(m_expandedidf->fullPath)) { OptionalIdfFile idf = IdfFile::load(m_expandedidf->fullPath); if (idf){ WeatherFileFinder::extractDetails(*idf, tv, m_filelocationname, m_weatherfilename); } else { throw std::runtime_error("Unable to load IDF " + toString(m_expandedidf->fullPath) + " file could not be parsed"); } } else { throw std::runtime_error("Unable to load IDF " + toString(m_expandedidf->fullPath) + " file does not exist"); } } return tv; }
ToolVersion EnergyPlusJob::getToolVersionImpl(const std::string &t_toolName) const { if (t_toolName != "energyplus") { throw std::runtime_error("Invalid tool version request: " + t_toolName); } Files f = allInputFiles(); JobParams p = params(); getFiles(f, p); // start at default EnergyPlus version of 8.0 ToolVersion tv(8,0); if (m_idf){ if (boost::filesystem::exists(m_idf->fullPath)) { OptionalIdfFile idf = IdfFile::load(m_idf->fullPath); if (idf){ WeatherFileFinder::extractDetails(*idf, tv, m_filelocationname, m_weatherfilename); } else { throw std::runtime_error("Unable to load IDF " + toString(m_idf->fullPath) + " file could not be parsed"); } } else { throw std::runtime_error("Unable to load IDF " + toString(m_idf->fullPath) + " file does not exist"); } } return tv; }
int getDefaultFiles(void) { #ifdef DREAMCAST strcpy(actual_dir,MENU_DIR_DEFAULT); #endif return(getFiles(MENU_DIR_DEFAULT)); }
bool CopyFolder(std::wstring src, std::wstring dst) { if(!os_create_dir(dst)) return false; std::vector<SFile> curr_files=getFiles(src); for(size_t i=0;i<curr_files.size();++i) { if(curr_files[i].isdir) { bool b=CopyFolder(src+os_file_sep()+curr_files[i].name, dst+os_file_sep()+curr_files[i].name); if(!b) return false; } else { if(!os_create_hardlink(dst+os_file_sep()+curr_files[i].name, src+os_file_sep()+curr_files[i].name, false, NULL) ) { BOOL b=CopyFileW( (src+os_file_sep()+curr_files[i].name).c_str(), (dst+os_file_sep()+curr_files[i].name).c_str(), FALSE); if(!b) { return false; } } } } return true; }
void EnergyPlusJob::startHandlerImpl() { getFiles(allInputFiles(), params()); if (!m_idf) { throw std::runtime_error("No IDF file found in input files"); } if (!m_idf->hasRequiredFile(toPath("Energy+.idd"))) { // We did not have an idd set, so we should find one m_idf->addRequiredFile( toPath("Energy+.idd"), toPath("Energy+.idd")); } if (!m_idf->hasRequiredFile(toPath("in.epw"))) { openstudio::path epw = WeatherFileFinder::find(allParams(), m_filelocationname, m_weatherfilename); if (!epw.empty()) { m_idf->addRequiredFile(epw, toPath("in.epw")); } } // And add the now fully outfited idf with required idd and such addRequiredFile(*m_idf, toPath("in.idf")); }
int main(void) { gfxInitDefault(); if(R_FAILED(ndspInit())) return 0; #ifdef DEBUG LightLock_Init(&debug_lock); consoleInit(GFX_BOTTOM, &bottomScreen); consoleDebugInit(debugDevice_CONSOLE); #endif consoleInit(GFX_TOP, &topScreen); //aptHook(&hookCookie, AptEventHook, NULL); svcCreateEvent(&bufferReadyConsumeRequest, RESET_STICKY); svcCreateEvent(&bufferReadyProduceRequest, RESET_STICKY); getFiles(); bool exit = false; while (!exit) { std::string filename = select_file(); exit = stream_file(filename); } ndspExit(); gfxExit(); return 0; }
/*prints all the files associated with any word*/ int so(char *str, hashTable *ht) { char *word; FileNode *fptr; /* Iterates through filenames */ if (strcmp(strtok(str, " "), "so") != 0) { printf("I did not get 'so' inside sa function!!\n"); return 1; } /* goes through each word in input */ while ((word = strtok(NULL, " "))) { for (ptr = getFiles(word, root); ptr != NULL; ptr = ptr->next) { insert_to_list(t, ptr->filename); } } /* Means we got no matches */ if (t->files == NULL) { printf("No matches found.\n"); destroyTree(t); return 1; } /* prints all the filenames */ for (ptr = t->files; ptr->next != NULL; ptr = ptr->next) printf("%s, ", ptr->filename); if (ptr) printf("%s\n", ptr->filename); destroyTree(t); return 0; }
void DirAnalyzer::getFiles(path folder_path, vector<File> & files) { vector<path> files_to_read = readFolder(folder_path); for (vector<path> ::const_iterator it (files_to_read.begin()); it != files_to_read.end(); ++it) { path p=*it; try { if (is_regular_file(p)) // is p a regular file? { File new_file(p); /*File new_file; new_file.setName(p.filename()); new_file.setPath(p.string()); new_file.setSize(file_size(p));*/ files.push_back(new_file); } else if (is_directory(p)) // is p a directory? { getFiles(p, files); } } catch (const filesystem_error& ex) { cout << ex.what() << '\n'; exit(1); } } }
void UmlPackage::fileControl(bool ci) { UmlPackage * prj = getProject(); Q3CString prjfile = prj->supportFile(); BooL rec; BooL reload; Q3CString cmd; if (! prj->propertyValue((ci) ? "check-in-cmd" : "check-out-cmd", cmd)) cmd = "specify the command containing %file and %dir or %dironly"; Dialog dialog(ci, cmd, rec, reload); // the dialog execution set 'cmd' and 'rec' if (dialog.exec() == QDialog::Accepted) { // save the command for a future usage prj->set_PropertyValue((ci) ? "check-in-cmd" : "check-out-cmd", cmd); if (reload) saveProject(); // get files list Q3Dict<void> files; getFiles(files, (rec) ? ~0u : 1); if (this == prj) getAuxFiles(files); // apply the command on each file Q3DictIterator<void> it(files); QFileInfo prjpath(prjfile); QString dir = prjpath.dirPath(TRUE); QString dironly = dir; int index; if ((dironly.length() > 3) && (((const char *) dironly)[1] == ':') && (((const char *) dironly)[2] == '/')) dironly = dironly.mid(2); while ((index = cmd.find("%dironly")) != -1) cmd.replace(index, 8, dironly); while ((index = cmd.find("%dir")) != -1) cmd.replace(index, 4, dir); while (it.current()) { QString s = cmd; while ((index = s.find("%file")) != -1) s.replace(index, 5, it.currentKey()); system((const char *) s); ++it; } UmlCom::trace("Done."); if (reload) loadProject(prjfile); } }
STDMETHODIMP GuestSessionWrap::COMGETTER(Files)(ComSafeArrayOut(IGuestFile *, aFiles)) { LogRelFlow(("{%p} %s: enter aFiles=%p\n", this, "GuestSession::getFiles", aFiles)); VirtualBoxBase::clearError(); HRESULT hrc; try { CheckComArgOutPointerValidThrow(aFiles); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) throw autoCaller.rc(); hrc = getFiles(ArrayComTypeOutConverter<IGuestFile>(ComSafeArrayOutArg(aFiles)).array()); } catch (HRESULT hrc2) { hrc = hrc2; } catch (...) { hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); } LogRelFlow(("{%p} %s: leave *aFiles=%zu hrc=%Rhrc\n", this, "GuestSession::getFiles", ComSafeArraySize(*aFiles), hrc)); return hrc; }
void SMSC95xxUSB::readStart() { ProcessID pid = getFiles()->get(m_transferFile)->mount; Size rxSize = m_packetSize; //SMSC9512_DEFAULT_HS_BURST_CAP_SIZE; //size + ReceiveCommandSize; Size frameLength = 0; DEBUG(""); // Get receive packet buffer m_rxPacket = m_smsc->getReceiveQueue()->get(); if (!m_rxPacket) { ERROR("no free receive packet buffer available"); return; } // Begin USB transfer Error err = beginTransfer( USBTransfer::Bulk, USBTransfer::In, m_endpoints[0].endpointAddress & 0xf, m_rxPacket->data, rxSize, m_endpoints[0].maxPacketSize, m_readFinished ); if (err != ESUCCESS) ERROR("failed to submit packet receive request"); }
void PreviewIESJob::startHandlerImpl() { LOG(Debug, "Starting job"); getFiles(allInputFiles()); openstudio::path theoutdir = boost::filesystem::complete(outdir(true)); boost::filesystem::create_directories(theoutdir); addParameter("ies2rad", "-o"); addParameter("ies2rad", "ov"); addParameter("ies2rad", toString(theoutdir/toPath("in.ies"))); addParameter("rad", toString(theoutdir/toPath("ov.rif"))); addParameter("ra_image", "-z"); addParameter("ra_image", "-b"); addParameter("ra_image", "ov_y.hdr"); #ifdef Q_OS_WIN addParameter("ra_image", "out.bmp"); #else addParameter("ra_image", "out.tiff"); #endif // copy ies to "in.ies" addRequiredFile(*m_ies, toPath("in.ies")); writeSurfFile(theoutdir/toPath("surf.rad"), 24); writeRifFile(theoutdir/toPath("ov.rif"), theoutdir/toPath("ov.rad"), theoutdir/toPath("surf.rad"), "Z", "y", theoutdir/toPath("ov.oct"), "-ab 1 -ds .15"); }
void MainWindow::MenuEvents() { this->connect(this->menu.load_img, SIGNAL(triggered()), this, SLOT(getFiles())); this->connect(this->menu.compare_img, SIGNAL(triggered()), this, SLOT(compareFiles())); this->connect(this->menu.exit, SIGNAL(triggered()), this, SLOT(close())); this->connect(this->menu.about, SIGNAL(triggered()), this, SLOT(aboutDialog())); }
static TemplateList getTemplates(const QDir &dir) { const QStringList files = getFiles(dir, true); TemplateList templates; templates.reserve(files.size()); foreach (const QString &file, files) templates.append(File(file, dir.dirName())); return templates; }
void ExpandObjectsJob::startHandlerImpl() { addExpectedOutputFile(openstudio::toPath("expanded.idf")); getFiles(allInputFiles()); // copy idf to "in.idf" copyRequiredFiles(*m_idf, "idf", toPath("in.epw")); addRequiredFile(*m_idf, toPath("in.idf")); }
void CameraControlWindow::updateTrackFiles() { trackFileArray.fastClear(); trackFileArray.append(noSpline); getFiles("*.trk", trackFileArray); for (int i = 1; i < trackFileArray.size(); ++i) { trackFileArray[i] = trackFileArray[i].substr(0, trackFileArray[i].length() - 4); } trackFileIndex = iMin(trackFileArray.size() - 1, trackFileIndex); }
bool Directory::delete_() throw() { ArrayList<File> files = getFiles(); ArrayList<Directory> directories = getDirectories(); for(File& i : files) if(! i.delete_()) return false; for(Directory& i : directories) if(! i.delete_()) return false; return FileImplementation::deleteDirectory(mPath); }
void CloneThread::run() { QStringList files; QStringList absoluteSourceFiles; QStringList absoluteDestinationFiles; quint64 totalSize; // Searching { emit OnProgressChanged(tr("Searching..."), 0, 0); if (!getFiles(files)) { return; } if (!getAbsolutePaths(files, absoluteSourceFiles, absoluteDestinationFiles)) { return; } printLists(files, absoluteSourceFiles, absoluteDestinationFiles); } // Calculating { emit OnProgressChanged(tr("Calculating..."), 0, 0); totalSize = getTotalSize(absoluteSourceFiles); if (mTerminated) { return; } qDebug() << "Total size: " << totalSize; } // Deleting { emit OnProgressChanged(tr("Deleting old folder..."), 0, 0); if (!deleteFolder(mDestinationPath)) { return; } } // Cloning { if (!cloneFiles(absoluteSourceFiles, absoluteDestinationFiles, totalSize)) { return; } } }
bool getFiles(const std::string & folder, std::vector<std::string> & filePaths, bool recursive) { // Open the directory DIR * dir = opendir(folder.c_str()); if(!dir) { perror("E: Couldn't open directory. Cause"); return false; } struct stat st; dirent * e = readdir(dir); if(e) { do { // Do not explore the two special directories "." and ".." if(strcmp(e->d_name, ".") == 0 || strcmp(e->d_name, "..") == 0) { continue; } // Get file status std::string path = folder + '/' + e->d_name; stat(path.c_str(), &st); // Is it a directory? if(S_ISDIR(st.st_mode)) { if(recursive) { // Explore subdirectory //std::cout << "D - " << path << std::endl; getFiles(path, filePaths, true); } } else { // Add file to list //std::cout << "F - " << path << std::endl; filePaths.push_back(path); } } while((e = readdir(dir))); // while there is a file to read } // Close the directory if(closedir(dir) == -1) { perror("E: An error occurred closing the directory. Cause"); // Note: the function must return true if it got the files. } return true; }
int main(int argc, const char * argv[]) { FILE *fasta1 = NULL; FILE *fasta2 = NULL; int scoring[3]; getFiles(argc, 6, argv, &fasta1, &fasta2, scoring); //int scoring[3] = {MATCH_SCORE, MISMATCH_SCORE, GAP_SCORE}; localAlignment(fasta1, fasta2, scoring); return 0; }
void FtpApp::refreshList() { fileList->clear(); fileSize.clear(); //this->setContentsMargins(250,0,0,0); //this->setCentralWidget(processLabel); getFiles(); }