Create a default user projects folder
This commit is contained in:
parent
28c6967dbc
commit
e6dd95e83a
|
@ -17,6 +17,7 @@ wxString PATHS::GetUserScriptingPath()
|
||||||
return tmp.GetFullPath();
|
return tmp.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString PATHS::GetUserTemplatesPath()
|
wxString PATHS::GetUserTemplatesPath()
|
||||||
{
|
{
|
||||||
wxFileName tmp;
|
wxFileName tmp;
|
||||||
|
@ -26,5 +27,18 @@ wxString PATHS::GetUserTemplatesPath()
|
||||||
tmp.AppendDir( SETTINGS_MANAGER::GetSettingsVersion() );
|
tmp.AppendDir( SETTINGS_MANAGER::GetSettingsVersion() );
|
||||||
tmp.AppendDir( "templates" );
|
tmp.AppendDir( "templates" );
|
||||||
|
|
||||||
|
return tmp.GetFullPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString PATHS::GetDefaultUserProjectsPath()
|
||||||
|
{
|
||||||
|
wxFileName tmp;
|
||||||
|
|
||||||
|
tmp.AssignDir( KIPLATFORM::ENV::GetDocumentsDir() );
|
||||||
|
tmp.AppendDir( "kicad" );
|
||||||
|
tmp.AppendDir( SETTINGS_MANAGER::GetSettingsVersion() );
|
||||||
|
tmp.AppendDir( "projects" );
|
||||||
|
|
||||||
return tmp.GetFullPath();
|
return tmp.GetFullPath();
|
||||||
}
|
}
|
|
@ -60,6 +60,7 @@
|
||||||
#include <wx/ffile.h>
|
#include <wx/ffile.h>
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
#include <tools/ee_inspection_tool.h>
|
#include <tools/ee_inspection_tool.h>
|
||||||
|
#include <paths.h>
|
||||||
|
|
||||||
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName )
|
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName )
|
||||||
{
|
{
|
||||||
|
@ -90,7 +91,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName )
|
||||||
savePath = GetMruPath();
|
savePath = GetMruPath();
|
||||||
|
|
||||||
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
||||||
savePath = wxStandardPaths::Get().GetDocumentsDir();
|
savePath = PATHS::GetDefaultUserProjectsPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Schematic Files" ), savePath.GetPath(),
|
wxFileDialog dlg( this, _( "Schematic Files" ), savePath.GetPath(),
|
||||||
|
|
|
@ -7,6 +7,7 @@ class PATHS
|
||||||
public:
|
public:
|
||||||
static wxString GetUserScriptingPath();
|
static wxString GetUserScriptingPath();
|
||||||
static wxString GetUserTemplatesPath();
|
static wxString GetUserTemplatesPath();
|
||||||
|
static wxString GetDefaultUserProjectsPath();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -38,6 +38,7 @@
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <kiplatform/environment.h>
|
#include <kiplatform/environment.h>
|
||||||
#include <core/kicad_algo.h>
|
#include <core/kicad_algo.h>
|
||||||
|
#include <paths.h>
|
||||||
|
|
||||||
#include "project_tree_item.h"
|
#include "project_tree_item.h"
|
||||||
#include "project_tree.h"
|
#include "project_tree.h"
|
||||||
|
@ -201,7 +202,7 @@ void PROJECT_TREE_PANE::onOpenDirectory( wxCommandEvent& event )
|
||||||
|
|
||||||
// As a last resort use the user's documents folder.
|
// As a last resort use the user's documents folder.
|
||||||
if( curr_dir.IsEmpty() || !wxFileName::DirExists( curr_dir ) )
|
if( curr_dir.IsEmpty() || !wxFileName::DirExists( curr_dir ) )
|
||||||
curr_dir = wxStandardPaths::Get().GetDocumentsDir();
|
curr_dir = PATHS::GetDefaultUserProjectsPath();
|
||||||
|
|
||||||
if( !curr_dir.IsEmpty() )
|
if( !curr_dir.IsEmpty() )
|
||||||
curr_dir += wxFileName::GetPathSeparator();
|
curr_dir += wxFileName::GetPathSeparator();
|
||||||
|
@ -540,7 +541,7 @@ void PROJECT_TREE_PANE::ReCreateTreePrj()
|
||||||
if( !fn.IsOk() )
|
if( !fn.IsOk() )
|
||||||
{
|
{
|
||||||
fn.Clear();
|
fn.Clear();
|
||||||
fn.SetPath( wxStandardPaths::Get().GetDocumentsDir() );
|
fn.SetPath( PATHS::GetDefaultUserProjectsPath() );
|
||||||
fn.SetName( NAMELESS_PROJECT );
|
fn.SetName( NAMELESS_PROJECT );
|
||||||
fn.SetExt( ProjectFileExtension );
|
fn.SetExt( ProjectFileExtension );
|
||||||
prjReset = true;
|
prjReset = true;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
#include <track.h>
|
#include <track.h>
|
||||||
#include <footprint.h>
|
#include <footprint.h>
|
||||||
|
#include <paths.h>
|
||||||
#include <dialog_gendrill.h>
|
#include <dialog_gendrill.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
|
@ -422,7 +423,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
|
||||||
defaultPath = Prj().AbsolutePath( defaultPath );
|
defaultPath = Prj().AbsolutePath( defaultPath );
|
||||||
|
|
||||||
if( defaultPath.IsEmpty() )
|
if( defaultPath.IsEmpty() )
|
||||||
defaultPath = wxStandardPaths::Get().GetDocumentsDir();
|
defaultPath = PATHS::GetDefaultUserProjectsPath();
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath, fn.GetFullName(),
|
wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath, fn.GetFullName(),
|
||||||
ReportFileWildcard(), wxFD_SAVE );
|
ReportFileWildcard(), wxFD_SAVE );
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include <wx/wupdlock.h>
|
#include <wx/wupdlock.h>
|
||||||
#include <settings/common_settings.h>
|
#include <settings/common_settings.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
|
#include <paths.h>
|
||||||
#include <project/project_file.h>
|
#include <project/project_file.h>
|
||||||
#include <project/project_local_settings.h>
|
#include <project/project_local_settings.h>
|
||||||
#include <project/net_settings.h>
|
#include <project/net_settings.h>
|
||||||
|
@ -167,7 +168,7 @@ bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName, bo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
path = wxStandardPaths::Get().GetDocumentsDir();
|
path = PATHS::GetDefaultUserProjectsPath();
|
||||||
// leave name empty
|
// leave name empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +420,7 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
|
||||||
savePath = GetMruPath();
|
savePath = GetMruPath();
|
||||||
|
|
||||||
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
||||||
savePath = wxStandardPaths::Get().GetDocumentsDir();
|
savePath = PATHS::GetDefaultUserProjectsPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileName fn( savePath.GetPath(), orig_name, KiCadPcbFileExtension );
|
wxFileName fn( savePath.GetPath(), orig_name, KiCadPcbFileExtension );
|
||||||
|
@ -1040,7 +1041,7 @@ bool PCB_EDIT_FRAME::doAutoSave()
|
||||||
|
|
||||||
if( GetBoard()->GetFileName().IsEmpty() )
|
if( GetBoard()->GetFileName().IsEmpty() )
|
||||||
{
|
{
|
||||||
tmpFileName = wxFileName( wxStandardPaths::Get().GetDocumentsDir(), wxT( "noname" ),
|
tmpFileName = wxFileName( PATHS::GetDefaultUserProjectsPath(), wxT( "noname" ),
|
||||||
KiCadPcbFileExtension );
|
KiCadPcbFileExtension );
|
||||||
GetBoard()->SetFileName( tmpFileName.GetFullPath() );
|
GetBoard()->SetFileName( tmpFileName.GetFullPath() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue