void CodeManager::saveSource() { Q_ASSERT(!model_->source().isNull()); QFile source(sourceFilePath()); Util::writeFile(&source, model_->source()); model_->setSource(QString::null); }
void flushFile( const std::string& account, const std::string& tag, const std::string& fileName ){ boost::filesystem::path accountDir( account ); if( !boost::filesystem::exists( accountDir ) ) boost::filesystem::create_directory( accountDir ); boost::filesystem::path tagDir( tag.c_str() ); tagDir = accountDir / tagDir; if( !boost::filesystem::exists( tagDir ) ) boost::filesystem::create_directory( tagDir ); boost::filesystem::path sourceFilePath( fileName ); boost::filesystem::path destFilePath = tagDir / sourceFilePath.leaf(); if( boost::filesystem::exists(destFilePath) ) boost::filesystem::remove(destFilePath); boost::filesystem::copy_file( sourceFilePath, destFilePath ); }
void CodeManager::copyTemplate() { QFile cpuTemplate(Settings::instance()->templatePath()); if (cpuTemplate.exists()) { QFile source(sourceFilePath()); Util::copyFile(&cpuTemplate, &source); } else { throw PoaException(QString(qApp->translate("codemanager","Could not copy code template: %1 does not exist.")).arg(Settings::instance()->templatePath())); } }
QString CodeManager::sourceCode() { if (!model_->source().isNull()) { return model_->source(); } QFile source(sourceFilePath()); if (source.exists()) { return Util::readFile(&source); } return QString::null; }
QString DwarfDie::sourceLocation() const { return sourceFilePath() + QLatin1Char(':') + QString::number(attribute(DW_AT_decl_line).toInt()); }