void K3bDataFileView::slotParentDir() { if( currentDir() != m_doc->root() ) { slotSetCurrentDir( currentDir()->parent() ); emit dirSelected( currentDir() ); } }
///////////////////////////// // Gets and stores full path void AegisubApp::GetFullPath(wxString arg) { if (wxIsAbsolutePath(arg)) { fullPath = arg; return; } // Is it a relative path? wxString currentDir(wxFileName::GetCwd()); if (currentDir.Last() != wxFILE_SEP_PATH) currentDir += wxFILE_SEP_PATH; wxString str = currentDir + arg; if (wxFileExists(str)) { fullPath = str; return; } // OK, it's neither an absolute path nor a relative path. // Search PATH. wxPathList pathList; pathList.AddEnvList(_T("PATH")); str = pathList.FindAbsoluteValidPath(arg); if (!str.IsEmpty()) { fullPath = str; return; } fullPath = _T(""); return; }
bool QtFileIconView::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setDirectory((const QString&)static_QUType_QString.get(_o+1)); break; case 1: setDirectory((const QDir&)*((const QDir*)static_QUType_ptr.get(_o+1))); break; case 2: newDirectory(); break; case 3: currentDir(); break; case 4: itemDoubleClicked((QIconViewItem*)static_QUType_ptr.get(_o+1)); break; case 5: slotDropped((QDropEvent*)static_QUType_ptr.get(_o+1),(const QValueList<QIconDragItem>&)*((const QValueList<QIconDragItem>*)static_QUType_ptr.get(_o+2))); break; case 6: viewLarge(); break; case 7: viewSmall(); break; case 8: viewBottom(); break; case 9: viewRight(); break; case 10: flowEast(); break; case 11: flowSouth(); break; case 12: itemTextTruncate(); break; case 13: itemTextWordWrap(); break; case 14: sortAscending(); break; case 15: sortDescending(); break; case 16: arrangeItemsInGrid(); break; case 17: slotRightPressed((QIconViewItem*)static_QUType_ptr.get(_o+1)); break; case 18: openFolder(); break; default: return QIconView::qt_invoke( _id, _o ); } return TRUE; }
int currentDirLength(const WCHAR* ps, int pathlen) { WCHAR *dir; if (pathlen > 2 && ps[1] == L':' && ps[2] != L'\\') { //drive-relative WCHAR d = ps[0]; int dirlen = 0; int di = 0; if ((d >= L'a') && (d <= L'z')) di = d - L'a' + 1; else if ((d >= L'A') && (d <= L'Z')) di = d - L'A' + 1; else return 0; /* invalid drive name. */ dir = currentDir(di); if (dir != NULL){ dirlen = (int)wcslen(dir); free(dir); } return dirlen; } else { static int curDirLenCached = -1; //relative to both drive and directory if (curDirLenCached == -1) { int dirlen = -1; dir = _wgetcwd(NULL, MAX_PATH); if (dir != NULL) { curDirLenCached = (int)wcslen(dir); free(dir); } } return curDirLenCached; } }
void StreamWG::captureImage() { QString fmt; QUrl currentFileURL; QUrl currentDir(Options::fitsDir()); QTemporaryFile tmpfile; tmpfile.open(); fmt = imgFormatCombo->currentText(); currentFileURL = QFileDialog::getSaveFileUrl(KStars::Instance(), i18n("Save Image"), currentDir, fmt ); if (currentFileURL.isEmpty()) return; if ( currentFileURL.isValid() ) { streamFrame->kPix.save(currentFileURL.toLocalFile(), fmt.toLatin1()); } else { QString message = i18n( "Invalid URL: %1", currentFileURL.url() ); KMessageBox::sorry( 0, message, i18n( "Invalid URL" ) ); } }
void FilterBar::setHistory(){ qWarning("HERE"); t=HISTORY; filters.clear(); this->update(); emit currentDir(history[index],false); }
/*! Search component's translation dile and installs translator to application */ void HsWidgetComponent::installTranslator() { QStringList possiblePaths; #ifdef Q_OS_WIN32 possiblePaths << "resource/qt/translations"; #else QDir currentDir(mRootPath); if (!currentDir.exists() || mRootPath.isEmpty()) { return; } while (currentDir.cdUp()) {} QString drive = currentDir.path(); drive.append("resource/qt/translations"); possiblePaths << drive; // if it is not in installed,then check z drive possiblePaths << "z:/resource/qt/translations"; #endif for(int i=0; i<possiblePaths.count(); ++i) { QString candidate = QDir::toNativeSeparators(possiblePaths.at(i)); if (QDir(candidate).exists()) { QString fileName(mTranslationFilename); fileName.append("_"); fileName.append(QLocale::system().name()); if (mTranslator.load(fileName, candidate)) { QCoreApplication::installTranslator(&mTranslator); break; } } } }
/// \brief remove folder bool ResourcesManager::removeFolder(const QString &dir) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"folder to remove: "+dir); bool errorFound=false; QDir currentDir(dir); QFileInfoList files = currentDir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot); int index=0; int loop_size=files.size(); while(index<loop_size) { if(files.at(index).isFile()) { QFile file(files.at(index).absoluteFilePath()); if(!file.remove()) { errorFound=true; ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"remove file failed: "+file.errorString()); } else ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file removed: "+file.fileName()); } else if(files.at(index).isDir()) removeFolder(files.at(index).absoluteFilePath()); else ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unknow file type for: "+files.at(index).absoluteFilePath()); index++; } if(!currentDir.rmpath(dir)) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"remove path failed, check right and if is empty: "+dir); errorFound=true; } return !errorFound; }
void ThumbView::slImageChanged( KFileItem *kfit ) { if( ! kfit ) return; // kdDebug(28000) << "changes to one thumbnail!" << endl; KURL thumbDir = currentDir(); KURL itemUrl = kfit->url(); /* delete filename */ itemUrl.setFileName( QString()); if( !itemUrl.equals( thumbDir, true )) { // kdDebug(28000) << "returning, because directory does not match: " << itemUrl.prettyURL() << endl; // kdDebug(28000) << "and my URL: " << thumbDir.prettyURL() << endl; return; } if( deleteImage( kfit )) { kdDebug(28000) << "was changed, deleted first!" << endl; } /* Trigger a new reading */ KFileItemList li; li.append( kfit ); slNewFileItems( li ); }
std::string getUniqueFileName(std::string directory, std::string baseFileName) { std::string fileAbsName; boost::filesystem::path currentDir(directory); int maximumExistingNumber = 0; //boost::regex pattern(base_file_name + ".*"); // list all files having this base file name // Check all the files matching this base file name and find the maximum serial number until now for (boost::filesystem::directory_iterator iter(currentDir),end; iter != end; ++iter) { std::string name = iter->path().filename().string(); if (strncmp(baseFileName.c_str(), name.c_str(), baseFileName.length()) == 0) { // regex_match(name, pattern)) { //cout << "MATCH: base=" << baseFileName << ", file=" << name << endl; int currentNumber = 0; name = name.substr(baseFileName.length() + 1); //cout << "After substr=" << name << endl; sscanf(name.c_str(), "%d", ¤tNumber); //cout << "NO= " << currentNumber << endl; if (currentNumber > maximumExistingNumber) { maximumExistingNumber = currentNumber; } } } //cout << "Max. existing no = " << maximum_existing_no << endl; // Return the next serial number return directory + "/" + baseFileName + "_" + boost::lexical_cast<std::string>(maximumExistingNumber + 1) + ".txt"; }
//remove preview file names foreach(QString elem,previewFileNames){ QDir currentDir(QFileInfo(elem).absoluteDir()); elem=QFileInfo(elem).completeBaseName(); QStringList files; files = currentDir.entryList(QStringList(elem+"*"), QDir::Files | QDir::NoSymLinks); foreach(QString file,files) QFile::remove(currentDir.absolutePath()+"/"+file); }
void K3bDataFileView::slotExecuted( QListViewItem* item ) { if( K3bDataDirViewItem* k = dynamic_cast<K3bDataDirViewItem*>( item ) ) { hideEditor(); // disable the K3bListView Editor slotSetCurrentDir( k->dirItem() ); emit dirSelected( currentDir() ); } }
DockWidget3DSettings::DockWidget3DSettings(QWidget *parent, GLWidget* ptr_gl) : QDockWidget(parent),ptr_glWidget(ptr_gl), ui(new Ui::DockWidget3DSettings) { ui->setupUi(this); close(); setContentsMargins(0,0,0,0); // Connect all the sliders and other widgets connect(ui->horizontalSliderDepthScale ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderUVScale ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderUVXOffset ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderUVYOffset ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderSpecularI ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderDiffuseI ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderLightPower ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->horizontalSliderLightRadius ,SIGNAL(valueChanged(int)),this,SLOT(updateSettings(int))); connect(ui->comboBoxPerformanceNoRays ,SIGNAL(activated(int)),this,SLOT(updateSettings(int))); connect(ui->comboBoxPerformanceNoTessSub ,SIGNAL(activated(int)),this,SLOT(updateSettings(int))); connect(ui->checkBoxPerformanceCullFace ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxPerformanceSimplePBR ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxBloomEffect ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxDOFEffect ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxLensFlaresEffect ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->checkBoxShowTriangleEdges ,SIGNAL(clicked()),this,SLOT(updateSettings())); connect(ui->comboBoxShadingModel ,SIGNAL(activated(int)), this,SLOT(selectShadingModel(int))); connect(ui->comboBoxShadingType ,SIGNAL(activated(int)), this,SLOT(updateSettings(int))); // loading 3d mesh signal and eviromental maps connect(ui->pushButtonLoadMesh ,SIGNAL(released()), ptr_glWidget,SLOT(loadMeshFromFile())); connect(ui->comboBoxChooseOBJModel ,SIGNAL(activated(QString)),ptr_glWidget,SLOT(chooseMeshFile(QString))); connect(ui->comboBoxSkyBox ,SIGNAL(activated(QString)),ptr_glWidget,SLOT(chooseSkyBox(QString))); // send current settings to glWidget connect(this,SIGNAL(signalSettingsChanged(Display3DSettings)),ptr_glWidget,SLOT(updatePerformanceSettings(Display3DSettings))); // ------------------------------------------------------- // // Loading cub maps folders // ------------------------------------------------------- // qDebug() << "Loading cubemaps folders:"; QDir currentDir(_find_data_dir(QString(RESOURCE_BASE) + "Core/2D/skyboxes")); currentDir.setFilter(QDir::Dirs); QStringList entries = currentDir.entryList(); qDebug() << "Looking for enviromental maps in Core/2D/skyboxes:"; for( QStringList::ConstIterator entry=entries.begin(); entry!=entries.end(); ++entry ){ QString dirname=*entry; if(dirname != tr(".") && dirname != tr("..")){ qDebug() << "Enviromental map:" << dirname; ui->comboBoxSkyBox->addItem(dirname); } }// end of for // setting cube map for glWidget ptr_glWidget->chooseSkyBox(ui->comboBoxSkyBox->currentText(),true); }
void ModuleManager::doInit() { // We start from a list of paths in m_paths. Each of those is a directory that // might (should) contain Calamares modules of any type/interface. // For each modules search path (directory), it is expected that each module // lives in its own subdirectory. This subdirectory must have the same name as // the module name, and must contain a settings file named module.desc. // If at any time the module loading procedure finds something unexpected, it // silently skips to the next module or search path. --Teo 6/2014 for ( const QString& path : m_paths ) { QDir currentDir( path ); if ( currentDir.exists() && currentDir.isReadable() ) { const QStringList subdirs = currentDir.entryList( QDir::AllDirs | QDir::NoDotAndDotDot ); for ( const QString& subdir : subdirs ) { currentDir.setPath( path ); bool success = currentDir.cd( subdir ); if ( success ) { QFileInfo descriptorFileInfo( currentDir.absoluteFilePath( QLatin1Literal( "module.desc") ) ); if ( ! ( descriptorFileInfo.exists() && descriptorFileInfo.isReadable() ) ) { cDebug() << Q_FUNC_INFO << "unreadable file: " << descriptorFileInfo.absoluteFilePath(); continue; } bool ok = false; QVariantMap moduleDescriptorMap = CalamaresUtils::loadYaml( descriptorFileInfo, &ok ); QString moduleName = ok ? moduleDescriptorMap.value( "name" ).toString() : QString(); if ( ok && ( moduleName == currentDir.dirName() ) && !m_availableDescriptorsByModuleName.contains( moduleName ) ) { m_availableDescriptorsByModuleName.insert( moduleName, moduleDescriptorMap ); m_moduleDirectoriesByModuleName.insert( moduleName, descriptorFileInfo.absoluteDir().absolutePath() ); } } else { cWarning() << "Cannot cd into module directory " << path << "/" << subdir; } } } else cDebug() << "ModuleManager bad search path" << path; } // At this point m_availableModules is filled with whatever was found in the // search paths. emit initDone(); }
void KovanTestWindow::openLogFile() { #ifdef linux QString mountPoint; while (1) { qApp->processEvents(); QFile mounts("/proc/mounts"); QString line; mounts.open(QIODevice::ReadOnly | QIODevice::Text); for (line = mounts.readLine(); !line.isNull(); line = mounts.readLine()) { if (!line.contains("/media/sd")) continue; QString testDirectory; QString testFile; QString serial = engine->serialNumber(); QFile currentFile; mountPoint = line.split(' ')[1]; QDir currentDir(mountPoint); qDebug() << "Current dir (mountPoint):" << currentDir.path(); testDirectory = "kovan-logs/"; testDirectory.append(serial.split('-')[0]); if (!currentDir.mkpath(testDirectory)) { qDebug() << "Unable to make directory"; continue; } testFile = testDirectory; testFile.append("/"); testFile.append(serial); testFile.append(".html"); logFile.setFileName(currentDir.absoluteFilePath(testFile)); if (!logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) { qDebug() << "Unable to create logfile" << logFile.fileName(); continue; } logFile.write("<p>Started a new test\n"); logFile.flush(); return; } } #endif return; }
wxString wxFileDialog::GetDirectory() const { wxString currentDir( m_fc.GetDirectory() ); if (currentDir.empty()) { // m_fc.GetDirectory() will return empty until the dialog has been shown // in which case use any previously provided value currentDir = m_dir; } return currentDir; }
void FilterBar::back(){ if (index>0 && t==HISTORY){ index--; if (index == 0) emit isFirst(!true); if (index == history.length()-2) emit isLast(!false); emit currentDir(history[index],false); this->update(); for (int i=0;i<history.length();i++) qWarning()<<history[i]; } }
bool CArchiver7ZIP::Extract(LPCTSTR ArcFileName,CConfigManager&,const CConfigExtract& Config,bool bSafeArchive,LPCTSTR OutputDir,CString &strLog) { if(!IsOK()){ return false; } if(!bSafeArchive){ strLog.Format(IDS_ERROR_DANGEROUS_ARCHIVE,ArcFileName); return false; } //出力先移動 CCurrentDirManager currentDir(OutputDir); //=========================== // DLLに渡すオプションの設定 //=========================== TRACE(_T("DLLに渡すオプションの設定\n")); CString Param;//コマンドライン パラメータ バッファ //解凍パラメータ Param+=_T("x "); //解凍 if(Config.ForceOverwrite){ //強制上書き Param+=_T("-aoa "); } Param+=_T("-scsUTF-8 "); //レスポンスファイルのコードページ指定 //作業ディレクトリ Param+=_T("\"-w"); Param+=UtilGetTempPath(); Param+=_T("\" "); //アーカイブファイル名指定 Param+=_T("\""); Param+=ArcFileName; Param+=_T("\" "); ASSERT(!Param.IsEmpty()); TRACE(_T("ArchiveHandler Commandline Parameter:%s\n"),Param); TRACE(_T("ArchiveHandler呼び出し\n")); std::vector<BYTE> szLog(LOG_BUFFER_SIZE); szLog[0]='\0'; int Ret=ArchiveHandler(NULL,C2UTF8(Param),(LPSTR)&szLog[0],LOG_BUFFER_SIZE-1); CString strTmp; UtilToUNICODE(strTmp,&szLog[0],szLog.size()-1,UTILCP_UTF8); //strLog=&szLog[0]; strLog=strTmp; return 0==Ret; }
int ScaleSettingsDialog::slotBtnOkClick() { mScaleFactor = spbScale->value(); // Получение относительного пути для файла фонового рисунка QDir currentDir(mProjectDirectory); mImage = currentDir.relativeFilePath(leImage->text()); this->accept(); return 0; }
void K3bDataFileView::slotDataItemRemoved( K3bDataItem* item ) { if( item->isDir() ) { if( static_cast<K3bDirItem*>(item)->isSubItem( currentDir() ) ) { slotSetCurrentDir( m_doc->root() ); } } if( m_itemMap.contains( item ) ) { delete m_itemMap[item]; m_itemMap.remove(item); } }
void FilterBar::forward(){ if (index<history.length()-1 && t==HISTORY){ index++; if (index==1) emit isFirst(!false); if (index==history.length()-1) emit isLast(!true); emit currentDir(history[index],false); this->update(); } else if (t!=HISTORY){ t==HISTORY; this->update(); } }
quint64 RecursiveDirJobHelper::calculateDirSize(const QString & dir) { QDir currentDir(dir); if ( !currentDir.exists() ) { emit errorOccured(Error(Error::NoSuchFileOrDirectory, dir)); return 0; } QFileInfoList currentList = currentDir.entryInfoList(dirFilters); QFileInfo currentItem; QStack<QFileInfoList> stack; quint64 totalSize = 0; int refreshCounter = 0; if ( m_reportProgress ) { //show busy waiting indicator emit setMaximum(0); emit setValue(0); } while(1){ if ( !currentList.isEmpty() ){ currentItem = currentList.takeFirst(); totalSize += stat_size(currentItem.absoluteFilePath()); if ( currentItem.isDir() && !currentItem.isSymLink() ) { if ( !currentDir.cd(currentItem.fileName()) ) { emit errorOccured(Error(Error::AccessDenied, currentItem.absoluteFilePath())); } else { stack.push(currentList); currentList = currentDir.entryInfoList(dirFilters); } } if ( m_reportProgress && (++refreshCounter % 100 == 0) ) emit setLabelText( tr("Calculating the size of \"%1\"... %2") .arg(dir).arg(DirOperations::bytesToString(totalSize)) ); } else { // list is empty if ( !stack.isEmpty() ){ currentList = stack.pop(); currentDir.cdUp(); } else break; } } totalSize += stat_size(dir); qDebug() << "calculateDirSize" << dir << totalSize; return totalSize; }
// ---------------------------------------------------------------------------- wxString MouseSap::FindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName) // ---------------------------------------------------------------------------- { // Find the absolute path where this application has been run from. // argv0 is wxTheApp->argv[0] // cwd is the current working directory (at startup) // appVariableName is the name of a variable containing the directory for this app, e.g. // MYAPPDIR. This is checked first. wxString str; // Try appVariableName if (!appVariableName.IsEmpty()) { str = wxGetenv(appVariableName); if (!str.IsEmpty()) return str; } #if defined(__WXMAC__) && !defined(__DARWIN__) // On Mac, the current directory is the relevant one when // the application starts. return cwd; #endif if (wxIsAbsolutePath(argv0)) return wxPathOnly(argv0); else { // Is it a relative path? wxString currentDir(cwd); if (currentDir.Last() != wxFILE_SEP_PATH) currentDir += wxFILE_SEP_PATH; str = currentDir + argv0; if (wxFileExists(str)) return wxPathOnly(str); } // OK, it's neither an absolute path nor a relative path. // Search PATH. wxPathList pathList; pathList.AddEnvList(wxT("PATH")); str = pathList.FindAbsoluteValidPath(argv0); if (!str.IsEmpty()) return wxPathOnly(str); // Failed return wxEmptyString; }
void TestUpdaterOptions::testOldFormatArgs() { const int argc = 6; char* argv[argc]; argv[0] = strdup("updater"); std::string currentDir("CurrentDir="); const char* appDir = 0; // CurrentDir is the path to the directory containing the main // Mendeley Desktop binary, on Linux and Mac this differs from // the root of the install directory #if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) appDir = "/tmp/path-to-app/lib/mendeleydesktop/libexec/"; FileUtils::mkpath(appDir); #elif defined(PLATFORM_MAC) appDir = "/tmp/path-to-app/Contents/MacOS/"; FileUtils::mkpath(appDir); #elif defined(PLATFORM_WINDOWS) appDir = "C:/path/to/app/"; #endif currentDir += appDir; argv[1] = strdup(currentDir.c_str()); argv[2] = strdup("TempDir=/tmp/updater"); argv[3] = strdup("UpdateScriptFileName=/tmp/updater/file_list.xml"); argv[4] = strdup("AppFileName=/path/to/app/theapp"); argv[5] = strdup("PID=123456"); UpdaterOptions options; options.parse(argc,argv); TEST_COMPARE(options.mode,UpdateInstaller::Setup); #if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) TEST_COMPARE(options.installDir,"/tmp/path-to-app"); #elif defined(PLATFORM_MAC) // /tmp is a symlink to /private/tmp on Mac TEST_COMPARE(options.installDir,"/private/tmp/path-to-app"); #else TEST_COMPARE(options.installDir,"C:/path/to/app/"); #endif TEST_COMPARE(options.packageDir,"/tmp/updater"); TEST_COMPARE(options.scriptPath,"/tmp/updater/file_list.xml"); TEST_COMPARE(options.waitPid,123456); for (int i=0; i < argc; i++) { free(argv[i]); } }
bool CArchiverUNGCA::Extract(LPCTSTR ArcFileName,CConfigManager&,const CConfigExtract &Config,bool bSafeArchive,LPCTSTR OutputDir,CString &strLog) { if(!IsOK()){ return false; } if(!bSafeArchive){ strLog.Format(IDS_ERROR_DANGEROUS_ARCHIVE,ArcFileName); return false; } //出力先移動 CCurrentDirManager currentDir(OutputDir); //=========================== // DLLに渡すオプションの設定 //=========================== TRACE(_T("DLLに渡すオプションの設定\n")); CString Param;//コマンドライン パラメータ バッファ //解凍パラメータ Param+= _T("e ") //解凍 _T("-sx1 ") //進捗ダイアログ表示 ; if(Config.ForceOverwrite){ //強制上書き Param+=_T("-yx0 "); }else{ Param+=_T("-yx1 "); } //アーカイブファイル名指定 Param+=_T("\""); Param+=ArcFileName; Param+=_T("\" "); ASSERT(!Param.IsEmpty()); TRACE(_T("ArchiveHandler Commandline Parameter:%s\n"),Param); TRACE(_T("ArchiveHandler呼び出し\n")); //char szLog[LOG_BUFFER_SIZE]={0}; std::vector<char> szLog(LOG_BUFFER_SIZE); szLog[0]='\0'; int Ret=ArchiveHandler(NULL,CT2A(Param),&szLog[0],LOG_BUFFER_SIZE-1); strLog=&szLog[0]; return 0==Ret; }
// Слот - щелчок по кнопке "Применить" int ScaleSettingsDialog::slotBtnApplyClick() { mScaleFactor = spbScale->value(); // Получение относительного пути для файла фонового рисунка QDir currentDir(mProjectDirectory); mImage = currentDir.relativeFilePath(leImage->text()); btnApply->setEnabled(false); btnOk->setFocus(); mIsDataSave = true; return 0; }
wxFileName wxFindAppFullName(const wxString& argv0, const wxString& cwd, const wxString& appVariableName) { wxFileName fileName(argv0); wxString str; wxString path; #if defined(__WXMSW__) if (!fileName.HasExt()) fileName.SetExt(wxT("exe")); #endif // Try appVariableName if (!appVariableName.IsEmpty()) path = wxGetenv(appVariableName); #if defined(__WXMAC__) && !defined(__DARWIN__) // On Mac, the current directory is the relevant one when // the application starts. if (path.IsEmpty()) path = cwd; #endif if (path.IsEmpty()) { if (wxIsAbsolutePath(fileName.GetFullPath())) path = fileName.GetFullPath(); else { // Is it a relative path? wxString currentDir(cwd); if (currentDir.Last() != wxFILE_SEP_PATH) currentDir += wxFILE_SEP_PATH; if (wxFileExists(currentDir + fileName.GetFullName())) path = currentDir; } } if (path.IsEmpty()) { // OK, it's neither an absolute path nor a relative path. // Search PATH. wxPathList pathList; pathList.AddEnvList(wxT("PATH")); path = wxFileName(pathList.FindAbsoluteValidPath(fileName.GetFullName())).GetPath(); } fileName.SetPath(path); return fileName; }
//bSafeArchiveは無視される bool CArchiverUNARJ::Extract(LPCTSTR ArcFileName,CConfigManager&,const CConfigExtract &Config,bool,LPCTSTR OutputDir,CString &strLog) { if(!IsOK()){ return false; } //出力先移動 CCurrentDirManager currentDir(OutputDir); //=========================== // DLLに渡すオプションの設定 //=========================== TRACE(_T("DLLに渡すオプションの設定\n")); CString Param;//コマンドライン パラメータ バッファ //解凍パラメータ Param+= _T("x ") //解凍 _T("-++ ") //UNARJ32.DLLのレジストリの設定を無視 _T("-htm+ ") //サウンドを使う _T("-htp7 ") //不正なパスを拒否 _T("-htc+ ") //展開できなかったファイルの数を返す _T("-hte+ ") //上書きオープンエラー _T("-jyc ") //フォルダ作成の確認キャンセル ; if(Config.ForceOverwrite){ //強制上書き Param+=_T("-jyo "); } //アーカイブファイル名指定 Param+=_T("\""); Param+=ArcFileName; Param+=_T("\" "); ASSERT(!Param.IsEmpty()); TRACE(_T("ArchiveHandler Commandline Parameter:%s\n"),Param); TRACE(_T("ArchiveHandler呼び出し\n")); //char szLog[LOG_BUFFER_SIZE]={0}; std::vector<char> szLog(LOG_BUFFER_SIZE); szLog[0]='\0'; int Ret=ArchiveHandler(NULL,CT2A(Param),&szLog[0],LOG_BUFFER_SIZE-1); strLog=&szLog[0]; return 0==Ret; }
QString QgsMSUtils::createTempFilePath() { //save the content of the file into a temporary location //generate a name considering the current time //struct timeval currentTime; //gettimeofday(¤tTime, NULL); time_t seconds; time( &seconds ); srand( seconds ); int randomNumber = rand(); QString tempFileName = QString::number( randomNumber ); QString tempFilePath; //on windows, store the temporary file in current_path/tmp directory, //on unix, store it in /tmp/qgis_wms_serv #ifndef WIN32 QDir tempFileDir( "/tmp/qgis_map_serv" ); if ( !tempFileDir.exists() ) //make sure the directory exists { QDir tmpDir( "/tmp" ); tmpDir.mkdir( "qgis_map_serv" ); } tempFilePath = "/tmp/qgis_map_serv/" + tempFileName; #else QDir tempFileDir( QDir::currentPath() + "/tmp" ); if ( !tempFileDir.exists() ) { QDir currentDir( QDir::currentPath() ); currentDir.mkdir( "tmp" ); } tempFilePath = QDir::currentPath() + "/tmp" + "/" + tempFileName; #endif //WIN32 QFileInfo testFile( tempFilePath ); while ( testFile.exists() ) { //change the name tempFilePath += "1"; testFile.setFile( tempFilePath ); } QgsMapServerLogger::instance()->printMessage( tempFilePath ); return tempFilePath; }
void FolderFilesList::checkNextItem(const QFileInfo &item) { if (m_cancelSearch) { return; } if (item.isFile()) { if (!m_binary) { QMimeType mimeType = QMimeDatabase().mimeTypeForFile(item); if (!mimeType.inherits(QStringLiteral("text/plain"))) { return; } } m_files << item.absoluteFilePath(); } else { QDir currentDir(item.absoluteFilePath()); if (!currentDir.isReadable()) { qDebug() << currentDir.absolutePath() << "Not readable"; return; } QDir::Filters filter = QDir::Files | QDir::NoDotAndDotDot | QDir::Readable; if (m_hidden) filter |= QDir::Hidden; if (m_recursive) filter |= QDir::AllDirs; if (!m_symlinks) filter |= QDir::NoSymLinks; // sort the items to have an deterministic order! const QFileInfoList currentItems = currentDir.entryInfoList(m_types, filter, QDir::Name | QDir::LocaleAware); bool skip; for (int i = 0; i<currentItems.size(); ++i) { skip = false; for (int j=0; j<m_excludeList.size(); j++) { if (m_excludeList[j].exactMatch(currentItems[i].fileName())) { skip = true; break; } } if (!skip) { checkNextItem(currentItems[i]); } } } }