Commit e80d0750 authored by charras's avatar charras
Browse files

make command-line invocation with relative paths work

parent 76fc4042
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -589,12 +589,12 @@ void WinEDA_App::SetDefaultSearchPaths( void )
}
}




/**
/** Function GetSettings
 * Get application settings
 * Get application settings
 *
 * @param aReopenLastUsedDirectory = true to switch to last opened directory, false to use current CWD
 * @return  none
 * @return  none
 */
 */
void WinEDA_App::GetSettings()
void WinEDA_App::GetSettings(bool aReopenLastUsedDirectory)
{
{
    wxASSERT( m_EDA_Config != NULL && m_EDA_CommonConfig != NULL );
    wxASSERT( m_EDA_Config != NULL && m_EDA_CommonConfig != NULL );


@@ -613,10 +613,13 @@ void WinEDA_App::GetSettings()


    m_EDA_Config->Read( wxT( "ShowPageLimits" ), &g_ShowPageLimits );
    m_EDA_Config->Read( wxT( "ShowPageLimits" ), &g_ShowPageLimits );


    if( aReopenLastUsedDirectory )
    {
        if( m_EDA_Config->Read( wxT( "WorkingDir" ), &Line ) && wxDirExists( Line ) )
        if( m_EDA_Config->Read( wxT( "WorkingDir" ), &Line ) && wxDirExists( Line ) )
        {
        {
            wxSetWorkingDirectory( Line );
            wxSetWorkingDirectory( Line );
        }
        }
    }


    m_EDA_Config->Read( wxT( "BgColor" ), &g_DrawBgColor );
    m_EDA_Config->Read( wxT( "BgColor" ), &g_DrawBgColor );
}
}
+4 −6
Original line number Original line Diff line number Diff line
@@ -43,7 +43,6 @@ bool WinEDA_App::OnInit()
{
{
    wxFileName         fn;
    wxFileName         fn;
    wxString           msg;
    wxString           msg;
    wxString           currCWD = wxGetCwd();
    WinEDA_CvpcbFrame* frame   = NULL;
    WinEDA_CvpcbFrame* frame   = NULL;


    InitEDA_Appl( wxT( "Cvpcb" ), APP_TYPE_CVPCB );
    InitEDA_Appl( wxT( "Cvpcb" ), APP_TYPE_CVPCB );
@@ -54,17 +53,16 @@ bool WinEDA_App::OnInit()
            return false;
            return false;
    }
    }


    GetSettings();                      // read current setup

    wxSetWorkingDirectory( currCWD );   // mofifie par GetSetting

    if( argc > 1 )
    if( argc > 1 )
    {
    {
        wxLogDebug( wxT( "CvPcb opening file <%s>" ), argv[1] );
        fn = argv[1];
        fn = argv[1];
        wxSetWorkingDirectory( fn.GetPath() );
        wxSetWorkingDirectory( fn.GetPath() );
    }
    }


    // read current setup and reopen last directory if no filename to open in command line
    bool reopenLastUsedDirectory = argc == 1;
    GetSettings(reopenLastUsedDirectory);

    g_DrawBgColor = BLACK;
    g_DrawBgColor = BLACK;


    wxString Title = GetTitle() + wxT( " " ) + GetBuildVersion();
    wxString Title = GetTitle() + wxT( " " ) + GetBuildVersion();
+1 −12
Original line number Original line Diff line number Diff line
@@ -869,25 +869,14 @@ static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel,
            switch( Struct->Type() )
            switch( Struct->Type() )
            {
            {
            case TYPE_SCH_COMPONENT:
            case TYPE_SCH_COMPONENT:
            {
                ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
                ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
                ( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
                ( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
            }
                break;
                break;


            case DRAW_SHEET_STRUCT_TYPE:
            case DRAW_SHEET_STRUCT_TYPE:
            {
                //DuplicateStruct calls GenCopy, which should handle
                //DuplicateStruct calls GenCopy, which should handle
                //m_AssociatedScreen and m_sRefCount properly.
                //m_AssociatedScreen, m_TimeStamp and m_sRefCount properly.
                DrawSheetStruct* sheet = (DrawSheetStruct*) Struct;
                sheet->m_TimeStamp = GetTimeStamp();

                //sheet->m_AssociatedScreen->m_UndoList  = NULL;
                //sheet->m_AssociatedScreen->m_RedoList  = NULL;
                //keep m_AssociatedScreen pointer & associated.
                //sheet->m_Son = NULL; m_son is involved in undo and redo.
                break;
                break;
            }


            default:
            default:
                ;
                ;
+3 −1
Original line number Original line Diff line number Diff line
@@ -146,7 +146,9 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()


    newitem->m_FileName      = m_FileName;
    newitem->m_FileName      = m_FileName;
    newitem->m_FileNameSize  = m_FileNameSize;
    newitem->m_FileNameSize  = m_FileNameSize;
    newitem->m_SheetName     = m_SheetName;
/*    newitem->m_SheetName     = m_SheetName;   m_SheetName must be unique for all sub sheets in a given sheet
*                                               so we no not duplicate sheet name
*/
    newitem->m_SheetNameSize = m_SheetNameSize;
    newitem->m_SheetNameSize = m_SheetNameSize;


    newitem->m_Label = NULL;
    newitem->m_Label = NULL;
+5 −1
Original line number Original line Diff line number Diff line
@@ -151,7 +151,11 @@ bool WinEDA_App::OnInit()


    /* init EESCHEMA */
    /* init EESCHEMA */
    SeedLayers();
    SeedLayers();
    GetSettings();

    // read current setup and reopen last directory if no filename to open in command line
    bool reopenLastUsedDirectory = argc == 1;
    GetSettings(reopenLastUsedDirectory);

    Read_Hotkey_Config( frame, false );   /* Must be called before creating
    Read_Hotkey_Config( frame, false );   /* Must be called before creating
                                           * the main frame  in order to
                                           * the main frame  in order to
                                           * display the real hotkeys in menus
                                           * display the real hotkeys in menus
Loading