void Foam::proxySurfaceWriter<Type>::write
(
    const fileName& outputDir,
    const fileName& surfaceName,
    const pointField& points,
    const faceList& faces,
    const bool verbose
) const
{
    // avoid bad values
    if (ext_.empty())
    {
        return;
    }

    if (!isDir(outputDir))
    {
        mkDir(outputDir);
    }

    fileName fName(outputDir/surfaceName + "." + ext_);

    if (verbose)
    {
        Info<< "Writing geometry to " << fName << endl;
    }

    MeshedSurfaceProxy<face>
    (
        points,
        faces
    ).write(fName);

}
Example #2
0
QString FGame::cachedImage(int size, FGameSizeConstrain fsc, FGameArt imgType ) {
    QString fscI;

    if(fsc == FWidth)
        fscI = "w_";
    else
        fscI = "h_";

    QString fName(QString::number(dbId) + "_" + FGameArtToStr(imgType) + "_" + fscI + QString::number(size) + ".png");
    QString dir = getCacheDir();
    QString cached = dir + "/" + fName;
    if(QFile(cached).exists())
        return cached;
    else {
        QString unCached = getArt(imgType);
        if(unCached == "")
            return unCached;


        QPixmap p(unCached);
        if(fsc == FWidth)
            p= p.scaledToWidth(size, Qt::SmoothTransformation);
        else
            p = p.scaledToHeight(size, Qt::SmoothTransformation);

        QFile file(cached);
        file.open(QIODevice::WriteOnly);
        p.save(&file, "png", 90);
        file.close();
        qDebug() << "Resized " << cached;
        return cached;
    }
}
Example #3
0
bool ConcreteDatabase::executeParamsLog(const char* format,...)
{
	if (!format)
		return false;

	va_list ap;
	char szQuery[MAX_QUERY_LEN];
	va_start(ap, format);
	int res = vsnprintf( szQuery, MAX_QUERY_LEN, format, ap );
	va_end(ap);

	if (!checkFmtError(res,format))
		return false;

	if (_shouldLogSQL)
	{
		string fName(Poco::DateTimeFormatter::format(Poco::LocalDateTime(), "%Y-%m-%d_logSQL.sql")); 

		string logsDir_fname = _sqlLogsDir+fName;
		std::ofstream log_file;
		log_file.open(logsDir_fname.c_str(),std::ios::app);
		if (log_file.is_open())
		{
			log_file << szQuery << ";\n";
			log_file.close();
		}
		else
		{
			// The file could not be opened
			_logger->error(Poco::format("SQL-Logging is disabled - Log file for the SQL commands could not be opened: %s",fName));
		}
	}

	return execute(szQuery);
}
Example #4
0
void filestuff::removeDir(QString dirName)
{
    QDir dir(dirName);
    QStringList dirList(dir.entryList(QDir::Files));
    for (int i = 0; i < dirList.count(); i++){
        QString fName(dirName + "/" + dirList[i]);
        QFile::remove(fName);
    }
    dirList.clear();
    dirList = dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
    for (int i = 0; i < dirList.count(); i++){
        QString fName(dirName + "/" + dirList[i]);
        removeDir(fName);
    }
    dir.rmdir(dirName);
}
Example #5
0
bool AyflyApp::OnInit()
{
    wxCmdLineParser cmdParser(g_cmdLineDesc, argc, argv);
    int res;
    {
        wxLogNull log;
        // Pass false to suppress auto Usage() message
        res = cmdParser.Parse(false);
    }
    int fileCount = cmdParser.GetParamCount();
    wxArrayString filenames;
    if(fileCount > 0)
    {        
        for(int i = 0; i < fileCount; i++)
        {
            wxString cmdFilename = cmdParser.GetParam(i);
            wxFileName fName(cmdFilename);
            fName.Normalize(wxPATH_NORM_LONG | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | wxPATH_NORM_ABSOLUTE);
            cmdFilename = fName.GetFullPath();
            filenames.Add(cmdFilename);
        }        
    }
    wxString title = wxT(WINDOW_TEXT);
    AyflyFrame *frame = new AyflyFrame(title.c_str(), filenames);

#ifndef _WIN32_WCE
    wxSize sz = frame->GetSize();
    sz.x = 550;
    sz.y = 400;
    frame->SetSize(sz);
#endif

    frame->Show(true);
    return true;
}
Example #6
0
void Dynamic::del(const QString &name)
{
    if (isRemote()) {
        if (sendCommand(Del, QStringList() << name)) {
            currentDelete=name;
        }
        return;
    }

    QList<Dynamic::Entry>::Iterator it=find(name);
    if (it==entryList.end()) {
        return;
    }
    QString fName(Utils::dataDir(constDir, false)+name+constExtension);
    bool isCurrent=currentEntry==name;

    if (!QFile::exists(fName) || QFile::remove(fName)) {
        if (isCurrent) {
            stop();
        }
        beginRemoveRows(QModelIndex(), it-entryList.begin(), it-entryList.begin());
        entryList.erase(it);
        endRemoveRows();
        return;
    }
}
Example #7
0
std::list<std::wstring> General::FindLanguages(std::wstring dir) {
    std::list<std::wstring> languages;
    WIN32_FIND_DATA ffd;
    HANDLE hFind;

    CLOG(L"Finding language translations in: %s", dir.c_str());
    dir += L"\\*.xml";
    hFind = FindFirstFile(dir.c_str(), &ffd);
    if (hFind == INVALID_HANDLE_VALUE) {
        CLOG(L"FindFirstFile() failed");
        return languages;
    }

    do {
        std::wstring fName(ffd.cFileName);

        if (fName.at(0) == L'.') {
            continue;
        }

        if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
            continue;
        }

        QCLOG(L"%s", fName.c_str());
        languages.push_back(fName);
    } while (FindNextFile(hFind, &ffd));
    FindClose(hFind);

    return languages;
}
Example #8
0
std::list<std::wstring> General::FindSkins(std::wstring dir) {
    std::list<std::wstring> skins;
    WIN32_FIND_DATA ffd;
    HANDLE hFind;

    CLOG(L"Finding skins in: %s", dir.c_str());
    dir += L"\\*";
    hFind = FindFirstFile(dir.c_str(), &ffd);
    if (hFind == INVALID_HANDLE_VALUE) {
        CLOG(L"FindFirstFile() failed");
        return skins;
    }

    do {
        std::wstring fName(ffd.cFileName);
        if (fName.at(0) == L'.') {
            continue;
        }
        QCLOG(L"%s", fName.c_str());
        skins.push_back(fName);
    } while (FindNextFile(hFind, &ffd));
    FindClose(hFind);

    return skins;
}
Example #9
0
bool MainApp::OnInit() {
    Settings settings = SettingsLoadFromFile();
	SettingsSetNewValues(settings);
    
    ChangeLanguage(settings.language);
    
	wxString cmdFilename = wxT("");
	wxCmdLineParser cmdParser(g_cmdLineDesc, argc, argv);
	int res;
	{
		wxLogNull log;
		// Pass false to suppress auto Usage() message
		res = cmdParser.Parse(false);
	}

	// Check if the user asked for command-line help
	if (res == -1 || res > 0 || cmdParser.Found(wxT("h")))
	{
		cmdParser.Usage();
		return false;
	}

	// Check if the user asked for the version
	if (cmdParser.Found(wxT("v")))
	{
#ifndef __WXMSW__
		wxLog::SetActiveTarget(new wxLogStderr);
#endif
		wxString msg = wxT("");
		msg << wxT(APP_NAME) << wxT(" ") << wxT(APP_VERSION);

		wxLogMessage(wxT("%s"), msg.c_str());
		return false;
	}

	// Check for a filename
	if (cmdParser.GetParamCount() > 0)
	{
		cmdFilename = cmdParser.GetParam(0);

		// Under Windows when invoking via a document
		// in Explorer, we are passed the short form.
		// So normalize and make the long form.
		wxFileName fName(cmdFilename);
		fName.Normalize(wxPATH_NORM_LONG|wxPATH_NORM_DOTS|wxPATH_NORM_TILDE|wxPATH_NORM_ABSOLUTE);
		cmdFilename = fName.GetFullPath();
	}

    // create the MainFrame
    frame = new MainFrame(cmdFilename);
    frame->Centre();
    frame->Show(true);

    // Our MainFrame is the Top Window
    SetTopWindow(frame);

    // initialization should always succeed
    return true;
}
Example #10
0
void SaveRestoreHandler::save( const std::string& fileName )
{
    std::string fName( fileName );
    if( fName.empty() )
        fName = _fileName;

    osgDB::writeObjectFile( *_state, fName );
}
Example #11
0
void Dynamic::start(const QString &name)
{
    if (isRemote()) {
        sendCommand(SetActive, QStringList() << name << "1");
        return;
    }

    if (Utils::findExe("perl").isEmpty()) {
        emit error(i18n("You need to install \"perl\" on your system in order for Cantata's dynamic mode to function."));
        return;
    }

    QString fName(Utils::dataDir(constDir, false)+name+constExtension);

    if (!QFile::exists(fName)) {
        emit error(i18n("Failed to locate rules file - %1", fName));
        return;
    }

    QString rules(Utils::cacheDir(constDir, true)+constActiveRules);

    QFile::remove(rules);
    if (QFile::exists(rules)) {
        emit error(i18n("Failed to remove previous rules file - %1", rules));
        return;
    }

    if (!QFile::link(fName, rules)) {
        emit error(i18n("Failed to install rules file - %1 -> %2", fName, rules));
        return;
    }

    int i=currentEntry.isEmpty() ? -1 : entryList.indexOf(currentEntry);
    QModelIndex idx=index(i, 0, QModelIndex());

    currentEntry=name;

    if (idx.isValid()) {
        emit dataChanged(idx, idx);
    }

    i=entryList.indexOf(currentEntry);
    idx=index(i, 0, QModelIndex());
    if (idx.isValid()) {
        emit dataChanged(idx, idx);
    }

    if (isRunning()) {
        emit clear();
        return;
    }
    if (controlApp(true)) {
        emit running(isRunning());
        emit clear();
        return;
    }
}
Example #12
0
std::string getFileNameOnly( std::string filename )
{
   wxFileName fName(wxString(filename.c_str(), wxConvUTF8));
   fName.Normalize();
   assert (fName.IsOk());
   {
      wxString name = fName.GetName();
      return std::string(name.mb_str(wxConvFile ));
   }
}
Example #13
0
bool AgentExecutor::UploadFile(const wxString& fileName) {
	if ( !IsConnected() ) {
		if ( !Login() ) {
			return false;
		}
	}

	while (true) {
		try {
			std::auto_ptr<EdiResponse> res(GetAgent().PostFile(fileName) );

            wxString fName(fileName);
			wxFileName fn(fName);

			if ( wxGetApp().GetCfg()->GetChild(ADVPCS_AGENT_CFG)->GetParamAsBool(ADVPCS_HTTP_AGENT_COMPRESED_CFG) ) {
				fName = fn.GetPath(wxPATH_GET_SEPARATOR) + fn.GetName() + ADVPCS_ZIP_EXT;
			} else {
				fName = fn.GetPath(wxPATH_GET_SEPARATOR) + fn.GetName() + ADVPCS_EDI_EXT;
			}

			if ( res->GetCode() == ADVPCS_POST_FILE_RECEIVED_OK - ADVPCS_BASE ) {
				LOG_INFO( GetLogger(), 0, wxString::Format(ADVPCS_UPLOAD_OK, fName));
				 return true;
			}

			::wxMessageBox(wxString::Format("[%ld] %s", res->GetCode(), res->GetMessage()), 
							   ADVPCS_ERROR_TITLE, 
							   wxOK | wxCENTRE | wxICON_ERROR);

			if ( res->GetCode() == ADVPCS_LOGIN_AUTH_ERR - ADVPCS_BASE 
				|| res->GetCode() == ADVPCS_POST_AUTH_ERR - ADVPCS_BASE ) {
				m_connected = false;
                if ( !Login() ) {
					return false;
				} else {
					continue;
				}
			}
			m_connected = false;
			return false;

		} catch ( CXmlLoadException& ) {
			wxMessageBox(ADVPCS_UNEXPECTED_REPLY_MSG, ADVPCS_ERROR_TITLE,
						  wxOK | wxCENTRE | wxICON_ERROR );
			m_connected = false;
			return false;
		} catch ( CAtfException& ex) {
			wxMessageBox((const char*)ex.GetText(), ADVPCS_ERROR_TITLE,
						  wxOK | wxCENTRE | wxICON_ERROR );
			m_connected = false;
			return false;
		};

	}
};
Example #14
0
//---------------------------------------------------------
bool CSG_Module_Library::Create(const CSG_String &File_Name)
{
	Destroy();

	TSG_PFNC_MLB_Initialize		MLB_Initialize;
	TSG_PFNC_MLB_Get_Interface	MLB_Get_Interface;

	wxString	sPath;
	wxFileName	fName(File_Name.c_str());

	fName.MakeAbsolute();
	m_File_Name		= fName.GetFullPath();

	//-----------------------------------------------------
	if( wxGetEnv(ENV_LIB_PATH, &sPath) && sPath.Length() > 0 )
	{
		wxSetEnv(ENV_LIB_PATH, CSG_String::Format(SG_T("%s%c%s"), sPath.c_str(), ENV_LIB_SEPA, SG_File_Get_Path(m_File_Name).c_str()));
	}
	else
	{
		wxSetEnv(ENV_LIB_PATH, SG_File_Get_Path(m_File_Name).c_str());
	}

	//-----------------------------------------------------
	if(	m_pLibrary->Load(m_File_Name.c_str())
	&&	(MLB_Get_Interface	= (TSG_PFNC_MLB_Get_Interface)	m_pLibrary->GetSymbol(SYMBOL_MLB_Get_Interface)) != NULL
	&&	(MLB_Initialize		= (TSG_PFNC_MLB_Initialize)		m_pLibrary->GetSymbol(SYMBOL_MLB_Initialize)   ) != NULL
	&&	 MLB_Initialize(m_File_Name) )
	{
		m_pInterface	= MLB_Get_Interface();
	}

	//-----------------------------------------------------
	if( sPath.Length() > 0 )
	{
		wxSetEnv(ENV_LIB_PATH, sPath);
	}
	else
	{
		wxUnsetEnv(ENV_LIB_PATH);
	}

	//-----------------------------------------------------
	if( Get_Count() > 0 )
	{
		for(int i=0; i<Get_Count(); i++)
			Get_Module(i)->Set_Managed(false);

		return( true );
	}

	Destroy();

	return( false );
}
Example #15
0
Foam::fileName Foam::IOobject::filePath() const
{
    fileName path = this->path();
    fileName objectPath = path/name();

    if (isFile(objectPath))
    {
        return objectPath;
    }
    else
    {
        if
        (
            time().processorCase()
         && (
                instance() == time().system()
             || instance() == time().constant()
            )
        )
        {
            fileName parentObjectPath =
                rootPath()/caseName()
               /".."/instance()/db_.dbDir()/local()/name();

            if (isFile(parentObjectPath))
            {
                return parentObjectPath;
            }
        }

        if (!isDir(path))
        {
            word newInstancePath = time().findInstancePath(instant(instance()));

            if (newInstancePath.size())
            {
                fileName fName
                (
                    rootPath()/caseName()
                   /newInstancePath/db_.dbDir()/local()/name()
                );

                if (isFile(fName))
                {
                    return fName;
                }
            }
        }
    }

    return fileName::null;
}
Example #16
0
bool MItem::result( WFileName& fn )
{
    if( ismakeable() ) {
        fn.setFName( fName() );
        if( _isTarget ) {
            fn.setExt( ext() );
        } else {
            fn.setExt( rule()->resultExt() );
        }
        return( true );
    }
    return( false );
}
Example #17
0
void SaveRestoreHandler::restore( const std::string& fileName )
{
    osg::notify( osg::WARN ) << "SaveRestoreHandler::restore() not currently implemented." << std::endl;
    return;

    std::string fName( fileName );
    if( fName.empty() )
        fName = _fileName;

    osg::Object* state = osgDB::readObjectFile( fileName );
    _state = dynamic_cast< osgbDynamics::PhysicsState* >( state );
    if( state == NULL )
        osg::notify( osg::WARN ) << "SaveRestoreHandler::restore(): Unable to read data from \"" << fName << "\"." << std::endl;
}
Example #18
0
QString FLManager::formatAssignValue(const QString &fieldName, int t, const QVariant &v, const bool upper)
{
  if (fieldName.isEmpty() || t == QVariant::Invalid)
    return "1 = 1";

  bool isText = (t == QVariant::String || t == QVariant::StringList);
  QString formatV(formatValue(t, v, upper));

  if (formatV.isEmpty())
    return "1 = 1";

  QString fName((upper && isText ? QString::fromLatin1("upper(") + fieldName +
                 QString::fromLatin1(")") : fieldName));
  return fName + "=" + formatV;
}
Example #19
0
bool expandFileName( std::string& filename)
{
	wxFileName fName(wxString(filename.c_str(), wxConvFile ));
   fName.Normalize();
   if (fName.IsOk())
   {
      wxString dirName = fName.GetFullPath();
      if (!dirName.Matches(wxT("*$*")))
      {
         filename = fName.GetFullPath().mb_str(wxConvFile );
         return true;
      }
   }
   return false;
}
void Foam::interpolation2DTable<Type>::readTable()
{
    fileName fName(fileName_);
    fName.expand();

    // Read data from file
    reader_()(fName, *this);

    if (this->empty())
    {
        FatalErrorInFunction
            << "table read from " << fName << " is empty" << nl
            << exit(FatalError);
    }

    // Check that the data are in ascending order
    checkOrder();
}
//---------------------------------------------------------
bool CSG_Translator::Create(const CSG_String &File_Name, bool bSetExtension, int iText, int iTranslation, bool bCmpNoCase)
{
	CSG_Table	Translations;
	CSG_String	fName(bSetExtension ? SG_File_Make_Path(NULL, File_Name, SG_T("lng")) : File_Name);

	SG_UI_Msg_Lock(true);

	Destroy();

	if( SG_File_Exists(fName) && Translations.Create(fName) )
	{
		Create(&Translations, iText, iTranslation, bCmpNoCase);
	}

	SG_UI_Msg_Lock(false);

	return( m_nTranslations > 0 );
}
Example #22
0
Foam::fileName Foam::functionEntries::includeEntry::includeFileName
(
    Istream& is
)
{
    fileName fName(is);
    fName.expand();

    if (fName.empty() || fName.isAbsolute())
    {
        return fName;
    }
    else
    {
        // relative name
        return fileName(is.name()).path()/fName;
    }
}
void Foam::meshToMeshNew::writeConnectivity
(
    const polyMesh& src,
    const polyMesh& tgt,
    const labelListList& srcToTargetAddr
) const
{
    Pout<< "Source size = " << src.nCells() << endl;
    Pout<< "Target size = " << tgt.nCells() << endl;

    word fName("addressing_" + src.name() + "_to_" + tgt.name());

    if (Pstream::parRun())
    {
        fName = fName +  "_proc" + Foam::name(Pstream::myProcNo());
    }

    OFstream os(src.time().path()/fName + ".obj");

    label vertI = 0;
    forAll(srcToTargetAddr, i)
    {
        const labelList& tgtAddress = srcToTargetAddr[i];
        forAll(tgtAddress, j)
        {
            label tgtI = tgtAddress[j];
            const vector& c0 = src.cellCentres()[i];

            const cell& c = tgt.cells()[tgtI];
            const pointField pts(c.points(tgt.faces(), tgt.points()));
            forAll(pts, j)
            {
                const point& p = pts[j];
                os  << "v " << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
                vertI++;
                os  << "v " << c0.x() << ' ' << c0.y() << ' ' << c0.z()
                    << nl;
                vertI++;
                os  << "l " << vertI - 1 << ' ' << vertI << nl;
            }
        }
    }
Example #24
0
Foam::fileName Foam::functionEntries::includeEntry::includeFileName
(
    Istream& is,
    const dictionary& dict
)
{
    fileName fName(is);
    // Substitute dictionary and environment variables. Allow empty
    // substitutions.
    stringOps::inplaceExpand(fName, dict, true, true);

    if (fName.empty() || fName.isAbsolute())
    {
        return fName;
    }
    else
    {
        // relative name
        return fileName(is.name()).path()/fName;
    }
}
// static
bool WidgetUnzipUtilityS60::unzip(const QString& aFileName, const QString& aTempFilePath, unsigned long& size)
    {
    // Qt handles paths using /-separator so make sure that paths are in native format.
    QString fileName = QDir::toNativeSeparators(aFileName);
    QString tempFilePath = QDir::toNativeSeparators(aTempFilePath);

    // perform syncronous unzip
    TPtrC16 fName(reinterpret_cast<const TUint16*>(fileName.utf16()));
    TPtrC16 tPath(reinterpret_cast<const TUint16*>(tempFilePath.utf16()));
    WidgetUnzipUtilityS60* wUnzip = NULL;
    TRAP_IGNORE(wUnzip = WidgetUnzipUtilityS60::NewL(fName, tPath, EFalse));
    if (wUnzip) {
        QEventLoop loop;
        while (wUnzip->RunUnzip()) {
            loop.processEvents(QEventLoop::AllEvents, 100);
        }
        size = wUnzip->size();
    }
    delete wUnzip;
    return (size > 0);
    }
/*!
* Creates a thumbnail based on the snapshot data.
@param filename - name of the image/video filename
@param snapshot - snapshot data from image/video
*/
void CxeThumbnailManagerSymbian::createThumbnail(const QString &filename,
                                                 const QImage &snapshot)
{
    CX_DEBUG_ENTER_FUNCTION();

    TPtrC16 fName(reinterpret_cast<const TUint16*>(filename.utf16()));
    CX_DEBUG(("Create thumbnail! filename = %s", filename.toAscii().constData()));

    if (mThumbnailManager) {
        CX_DEBUG(("creating thumbnails"));
        int thumbnailId = mThumbnailManager->setThumbnail(snapshot, filename);
        if (thumbnailId != -1) {
            CX_DEBUG(("Thumbnail ID = %d", thumbnailId));
            mThumbnailRequests.insert(filename, thumbnailId);
        } else {
            CX_DEBUG(("error initializing data to thumbnail manager"));
        }
    }

    CX_DEBUG_EXIT_FUNCTION();
}
Example #27
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)  
{
    connect(&db,SIGNAL(sendMessage(QString,MessageType)),this,SLOT(messView(QString,MessageType)));
    ui->setupUi(this);
    QString fName("verbsbase.db");
    //QFile::remove(fName);
    db.init(fName);
    db.createTables();
    db.createIndices();
    db.createTensesEs();

    //QSqlQueryModelPrivate
    verbsmodel = new QSqlQueryModel(this);
    verbsmodel->setQuery("select * from verbs_es;",db.getDb());
    /*
    QSqlQuery q(db.getDb());
    q.prepare("select * from verbs_es;");
     q.exec();
    verbsmodel->setQuery(q);
*/

    //verbsmodel= new QSqlTableModel(this,db.getDb());
    //verbsmodel->setTable("verbs_es");

    //verbsmodel->setEditStrategy(QSqlTableModel::OnManualSubmit);
    //verbsmodel->select();//Это ещё зачем?

    ui->tableViewVerbs->setModel(verbsmodel);
    ui->tableViewVerbs->hideColumn(0);

    //ui->tableViewVerbs->setSelectionModel(QItemSelectionModel::Rows);

    clipBoard = QApplication::clipboard();
    connect(clipBoard,SIGNAL(changed(QClipboard::Mode)),this, SLOT(clipBoardEventSlot(QClipboard::Mode)));


}
void Foam::interpolationTable<Type>::readTable()
{
    // preserve the original (unexpanded) fileName to avoid absolute paths
    // appearing subsequently in the write() method
    fileName fName(fileName_);

    fName.expand();

    // Read data from file
    reader_()(fName, *this);

    if (this->empty())
    {
        FatalErrorIn
        (
            "Foam::interpolationTable<Type>::readTable()"
        )   << "table read from " << fName << " is empty" << nl
            << exit(FatalError);
    }

    // Check that the data are okay
    check();
}
bool Foam::fileOperations::masterFileOperation::readHeader
(
    const bool checkGlobal,
    IOobject& io
) const
{
    bool ok = false;

Pout<< "Starting readHeader for:" << io.objectPath() << endl;


    if (Pstream::master())
    {
        fileName objPath;
        pathType searchType = fileOperation::NOTFOUND;
        word newInstancePath;
        fileName fName(filePath(checkGlobal, io, searchType, newInstancePath));

        Pout<< "readHeader actual file:" << fName << endl;

        if (!fName.empty() && Foam::isFile(fName))
        {
            IFstream is(fName);

            if (is.good() && io.readHeader(is))
            {
                ok = true;
            }
        }
    }
    Pstream::scatter(ok);
    Pstream::scatter(io.headerClassName());
    Pstream::scatter(io.note());

Pout<< "Done readHeader ok:" << ok << endl;
    return ok;
}
void Foam::functionObjectFile::createFiles()
{
    if (Pstream::master())
    {
        const word startTimeName =
            obr_.time().timeName(obr_.time().startTime().value());

        label i = 0;
        forAllConstIter(wordHashSet, names_, iter)
        {
            if (!filePtrs_.set(i))
            {
                fileName outputDir(baseFileDir()/prefix_/startTimeName);

                mkDir(outputDir);

                word fName(iter.key());

                // check if file already exists
                IFstream is(outputDir/(fName + ".dat"));
                if (is.good())
                {
                    fName = fName + "_" + obr_.time().timeName();
                }

                filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat")));

                initStream(filePtrs_[i]);

                writeFileHeader(i);

                i++;
            }
        }
    }
}