Commit 638decaf authored by Jacobo Aragunde Perez's avatar Jacobo Aragunde Perez Committed by jean-pierre charras

Commit fixes for bugs #1108773 and #1110651 and a bug fix improvement for #1101718 and #1102381.

parent 85562b45
...@@ -174,6 +174,8 @@ void SCH_EDIT_FRAME::Save_File( wxCommandEvent& event ) ...@@ -174,6 +174,8 @@ void SCH_EDIT_FRAME::Save_File( wxCommandEvent& event )
} }
break; break;
} }
UpdateTitle();
} }
...@@ -477,6 +479,8 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent ) ...@@ -477,6 +479,8 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent )
SaveEEFile( screen ); SaveEEFile( screen );
CreateArchiveLibraryCacheFile(); CreateArchiveLibraryCacheFile();
UpdateTitle();
} }
......
...@@ -46,10 +46,7 @@ ...@@ -46,10 +46,7 @@
bool SCH_EDIT_FRAME::CreateArchiveLibraryCacheFile() bool SCH_EDIT_FRAME::CreateArchiveLibraryCacheFile()
{ {
wxFileName fn; wxFileName fn = GetScreen()->GetFileName();
SCH_SCREENS ScreenList;
fn = ScreenList.GetFirst()->GetFileName();
fn.SetName( fn.GetName() + wxT( "-cache" ) ); fn.SetName( fn.GetName() + wxT( "-cache" ) );
fn.SetExt( SchematicLibraryFileExtension ); fn.SetExt( SchematicLibraryFileExtension );
......
...@@ -514,8 +514,7 @@ double SCH_EDIT_FRAME::BestZoom() ...@@ -514,8 +514,7 @@ double SCH_EDIT_FRAME::BestZoom()
wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet() wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
{ {
SCH_SCREENS ScreenList; wxFileName fn = GetScreen()->GetFileName();
wxFileName fn = ScreenList.GetFirst()->GetFileName();
#ifndef KICAD_GOST #ifndef KICAD_GOST
wxString filename = fn.GetName(); wxString filename = fn.GetName();
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <vector> #include <vector>
#include <build_version.h> #include <build_version.h>
#include <wx/dir.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/stdpaths.h> #include <wx/stdpaths.h>
...@@ -177,10 +178,25 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) ...@@ -177,10 +178,25 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
if( newProject ) if( newProject )
{ {
if ( !m_ProjectFileName.GetFullPath().EndsWith( g_KicadPrjFilenameExtension ) ) m_ProjectFileName.SetExt( ProjectFileExtension );
// Check if the project directory is empty
wxDir directory ( m_ProjectFileName.GetPath() );
if( directory.HasFiles() )
{ {
m_ProjectFileName.SetFullName( m_ProjectFileName.GetFullPath() + wxString msg = _( "The selected directory is not empty. "
g_KicadPrjFilenameExtension ); "We recommend you create projects in their own clean directory.\n\n"
"Do you want to create a new empty directory for the project?" );
if( IsOK( this, msg ) )
{
// Append a new directory with the same name of the project file
// and try to create it
m_ProjectFileName.AppendDir( m_ProjectFileName.GetName() );
if( !wxMkdir( m_ProjectFileName.GetPath() ) )
// There was a problem, undo
m_ProjectFileName.RemoveLastDir();
}
} }
if( event.GetId() == ID_NEW_PROJECT ) if( event.GetId() == ID_NEW_PROJECT )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment