void RecurseWorker::workDir( const QString &dir ) { QFileInfoList files( QDir(dir).entryInfoList() ); emit currentPath( dir ); foreach( const QFileInfo &fileInfo, files ) { if( mCancel ) { break; } if( fileInfo.fileName().left(1) == "." ) { continue; } if( fileInfo.isDir() ) { workDir( fileInfo.absoluteFilePath() ); } if( fileInfo.isFile() ) { mpDatabase->getTrackInfo( this, SLOT(updateTrackInfo(TrackInfo)), fileInfo.absoluteFilePath() ); } } }
void RecurseWorker::run() { mPatternWithoutTrackNr = Settings::value( Settings::RubberbandmanWithoutTrackNr ); mPatternWithTrackNr = Settings::value( Settings::RubberbandmanWithTrackNr ); workDir( mDir ); mpDatabase->call( this, SLOT(done()) ); exec(); }
int main(int argc, char **argv) { std::string fileName("/usr/bin/xterm"); std::string args("-T Test -fg green"); std::string workDir("."); std::cout << "fileName = " << fileName << ", args = " << args << ", workDir = " << workDir << std::endl; // Split arguments QStringList argList = QString(args.c_str()).split(" ", QString::SkipEmptyParts); foreach (QString arg, argList) { std::cout << "arg = [" << arg.trimmed().toStdString() << "]\n"; }
bool OpenModelica::compile(MOomc *_omc,QFileInfo moFile,QString modelToConsider,QDir storeFolder,const QFileInfoList & moDeps, QFileInfoList neededFiles, QFileInfoList neededFolders) { // check if model already loaded QFileInfo loadedMoFile = _omc->getFileOfClass(modelToConsider); bool loadOk; QString loadError; // load moDependencies if not already loaded // forceLoad = false for(int i=0;i<moDeps.size();i++) _omc->loadModel(moDeps.at(i).absoluteFilePath(),false,loadOk,loadError); // if not already loaded, reload if(loadedMoFile != moFile) { _omc->loadModel(moFile.absoluteFilePath(),true,loadOk,loadError); } // Create working dir QString tmpPath = _omc->getWorkingDirectory(); // if(workDir.exists()) // LowTools::removeDirContents(tmpPath); // else // { // QDir dir; // dir.mkpath(tmpPath); // } if(!QDir(tmpPath).exists()) QDir().mkpath(tmpPath); QDir workDir(tmpPath); // Copy file and folder LowTools::copyFilesInFolder(neededFiles,workDir.absolutePath()); _omc->changeDirectory(tmpPath); QString exeFile; QString initFile; bool success = _omc->buildModel(modelToConsider,exeFile,initFile); QFileInfoList filesToCopy; filesToCopy << QFileInfo(exeFile) << QFileInfo(initFile); LowTools::copyFilesInFolder(filesToCopy,storeFolder); return success; }
void MainWindow::cleanupWorkDir(const QString &path) { QDir workDir(path); foreach (const QFileInfo &subdirInfo, workDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs)) { QDir subdir(subdirInfo.absoluteDir()); foreach (const QString &file, subdir.entryList(QDir::NoDotAndDotDot | QDir::Files)) { subdir.remove(file); } workDir.rmdir(subdirInfo.fileName()); } QString name(workDir.dirName()); workDir.cdUp(); workDir.rmdir(name); }
void Settings::changeWorkingDirectory(const QString &workDirPath) { workDirPath_ = workDirPath; mutex_->lock(); qsettings_->sync(); QDir workDir(workDirPath); workDir.mkdir(".settings"); const QString settingsFileName = workDirPath + "/.settings/" + pluginName_ + ".conf"; QSettings * sett = new QSettings(settingsFileName, QSettings::IniFormat); sett->setIniCodec("UTF-8"); qsettings_.reset(sett); settingsFile_ = qsettings_->fileName(); mutex_->unlock(); }
void PluginManager::defaultLoad( ) { qDebug() << " " << "Default load started" ; QDir workDir(baseFolder); if ( !workDir.exists() ) { QString em= tr("base folder %1 doesn't exist, default load failed") .arg( baseFolder ); emit errorAppeared( em ); return ; } //=== get current available plugins ===== QStringList currAvailable = workDir.entryList(QDir::Files); #if defined(Q_OS_WIN) QRegExp trx("*.dll") ; #elif defined(__MACH__) QRegExp trx("*.dylib"); #else QRegExp trx("*.so"); #endif trx.setPatternSyntax(QRegExp::Wildcard ); currAvailable.filter( trx ); qDebug() << " " << "can load this plugins: " << currAvailable ; //=== foreach(QString pluginFileName, currAvailable) { QString fullfn( workDir.absoluteFilePath( pluginFileName ) ); QString newName; int ti = readPluginInformation( fullfn, newName); if (! ti ) { acceptPlugin(fullfn, newName); } }// foreach(QString pluginFileName, currAvailable)
/** * 通常のコンストラクタ */ ThreadContentWindow::ThreadContentWindow(wxWindow* parent, const wxString& threadContentPath): wxHtmlWindow(parent, ID_ThreadContentWindow, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO) { #ifdef __WXMSW__ // ウィンドウ内に入った際のイベント通知 this->Connect(ID_ThreadContentWindow, wxEVT_ENTER_WINDOW, wxMouseEventHandler(JaneClone::OnEnterWindow), NULL, this); #endif // 指定されたパスからHTMLファイルを読み出す wxString htmlSource = GetConvertedDatFile(threadContentPath); // 設定ファイルの準備をする // ユーザーのホームディレクトリを取得 wxDir workDir(::wxGetHomeDir()); wxDir jcDir(::wxGetHomeDir() + wxFILE_SEP_PATH + JANECLONE_DIR); // ユーザーのホームディレクトリに隠しフォルダがあるかどうか確認 if (!workDir.HasSubDirs(JANECLONE_DIR)) { ::wxMkdir(jcDir.GetName()); } if (!jcDir.HasSubDirs(wxT("prop"))) { ::wxMkdir(jcDir.GetName() + wxFILE_SEP_PATH + wxT("prop")); } // スキンを使わないならデフォルトフォントを設定する SkinInfo* skinInfo = new SkinInfo; bool useSkin = CheckSkinFiles(skinInfo); delete skinInfo; if (!useSkin) { // フォントのポイント数 const int p = 12; static int f_size[] = {p - 2, p - 1, p, p + 1, p + 2, p + 3, p + 4 }; #ifdef __WXMSW__ wxString fontName = wxT("MS Pゴシック"); this->SetFonts(fontName, wxEmptyString, f_size); #elif __WXGTK__ wxFont f; if (f.SetFaceName(wxT("Mona"))) { this->SetFonts(wxT("Mona"), wxEmptyString, f_size); } else if (f.SetFaceName(wxT("Mona-VLGothic"))) { this->SetFonts(wxT("Mona-VLGothic"), wxEmptyString, f_size); } else if (f.SetFaceName(wxT("Mona-sazanami"))) { this->SetFonts(wxT("Mona-sazanami"), wxEmptyString, f_size); } #elif __WXMAC__ wxString fontName = wxT("Mona"); this->SetFonts(fontName, wxEmptyString, f_size); #endif } // メモリに読み込んだHTMLを表示する this->SetPage(htmlSource); // 外部から参照可能なHTML this->m_htmlSource = htmlSource; // スクロールのフラグ fNeedScroll = false; }