예제 #1
0
KICADPCB::KICADPCB()
{
    wxFileName cfgdir( GetKicadConfigPath(), "" );
    cfgdir.AppendDir( "3d" );
    m_resolver.Set3DConfigDir( cfgdir.GetPath() );
    m_thickness = 1.6;
    m_pcb = NULL;

    return;
}
bool S3D_FILENAME_RESOLVER::Set3DConfigDir( const wxString& aConfigDir )
{
    if( aConfigDir.empty() )
        return false;

    wxFileName cfgdir( aConfigDir, wxT( "" ) );
    cfgdir.Normalize();

    if( false == cfgdir.DirExists() )
        return false;

    m_ConfigDir = cfgdir.GetPath();
    createPathList();

    return true;
}
예제 #3
0
bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
{
    if( !m_ConfigDir.empty() )
        return false;

    wxFileName cfgdir( aConfigDir, wxT( "" ) );
    cfgdir.Normalize();

    if( !cfgdir.DirExists() )
    {
        cfgdir.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );

        if( !cfgdir.DirExists() )
        {
            std::ostringstream ostr;
            ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
            wxString errmsg = _( "failed to create 3D configuration directory" );
            ostr << " * " << errmsg.ToUTF8() << "\n";
            errmsg = _( "config directory" );
            ostr << " * " << errmsg.ToUTF8() << " '";
            ostr << cfgdir.GetPath().ToUTF8() << "'";
            wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );

            return false;
        }
    }

    m_ConfigDir = cfgdir.GetPath();

    // inform the file resolver of the config directory
    if( !m_FNResolver->Set3DConfigDir( m_ConfigDir ) )
    {
        #ifdef DEBUG
        do {
            std::ostringstream ostr;
            ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
            ostr << " * could not set 3D Config Directory on filename resolver\n";
            ostr << " * config directory: '" << m_ConfigDir.ToUTF8() << "'";
            wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
        } while( 0 );
        #endif
    }

    cfgdir.AppendDir( wxT( "cache" ) );

    if( !cfgdir.DirExists() )
    {
        cfgdir.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );

        if( !cfgdir.DirExists() )
        {
            std::ostringstream ostr;
            ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
            wxString errmsg = "failed to create 3D cache directory";
            ostr << " * " << errmsg.ToUTF8() << "\n";
            errmsg = "cache directory";
            ostr << " * " << errmsg.ToUTF8() << " '";
            ostr << cfgdir.GetPath().ToUTF8() << "'";
            wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );

            return false;
        }
    }

    m_CacheDir = cfgdir.GetPathWithSep();
    return true;
}
TelegramLocalStorage::TelegramLocalStorage(QObject *parent): QObject(parent)
{
    QDir cfgdir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
    cfgdir.mkpath(qApp->applicationName() + QDir::separator() + qApp->applicationName() + QDir::separator() + TelegramLocalStorage::TELEGRAM_CONFIG);
}