Ejemplo n.º 1
0
std::string mitk::SceneIO::CreateEmptyTempDirectory()
{

  mitk::UIDGenerator uidGen("UID_",6);

  //std::string returnValue = mitk::StandardFileLocations::GetInstance()->GetOptionDirectory() + Poco::Path::separator() + "SceneIOTemp" + uidGen.GetUID();
  std::string returnValue = Poco::Path::temp() + "SceneIOTemp" + uidGen.GetUID();
  std::string uniquename = returnValue + Poco::Path::separator();
  Poco::File tempdir( uniquename );

  try
  {
    bool existsNot = tempdir.createDirectory();
    if (!existsNot)
      {
      MITK_ERROR << "Warning: Directory already exitsts: " << uniquename << " (choosing another)";
      returnValue = mitk::StandardFileLocations::GetInstance()->GetOptionDirectory() + Poco::Path::separator() + "SceneIOTempDirectory" + uidGen.GetUID();
      uniquename = returnValue + Poco::Path::separator();
      Poco::File tempdir2( uniquename );
      if (!tempdir2.createDirectory())
        {
        MITK_ERROR << "Warning: Second directory also already exitsts: " << uniquename;
        }
      }
  }
  catch( std::exception& e )
  {
    MITK_ERROR << "Could not create temporary directory " << uniquename << ":" << e.what();
    return "";
  }


  return returnValue;
}
Ejemplo n.º 2
0
/*!
  \internal
  Creates a new contact.  The properties of the contact are
  set from \a fromMap.
*/
OPimContact::OPimContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap( fromMap ), d( 0 )
{
    QString cats = mMap[ Qtopia::AddressCategory ];
    if ( !cats.isEmpty() )
        setCategories( idsFromString( cats ) );

    QString uidStr = find( Qtopia::AddressUid );

    if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) )
    {
        setUid( uidGen().generate() );
    }
    else
        setUid( uidStr.toInt() );

    //     if ( !uidStr.isEmpty() )
    //  setUid( uidStr.toInt() );
}