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();
|
||||
}
|
||||
|
||||
|
||||
wxString PATHS::GetUserTemplatesPath()
|
||||
{
|
||||
wxFileName tmp;
|
||||
|
@ -26,5 +27,18 @@ wxString PATHS::GetUserTemplatesPath()
|
|||
tmp.AppendDir( SETTINGS_MANAGER::GetSettingsVersion() );
|
||||
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();
|
||||
}
|
|
@ -60,6 +60,7 @@
|
|||
#include <wx/ffile.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <tools/ee_inspection_tool.h>
|
||||
#include <paths.h>
|
||||
|
||||
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();
|
||||
|
||||
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
||||
savePath = wxStandardPaths::Get().GetDocumentsDir();
|
||||
savePath = PATHS::GetDefaultUserProjectsPath();
|
||||
}
|
||||
|
||||
wxFileDialog dlg( this, _( "Schematic Files" ), savePath.GetPath(),
|
||||
|
|
|
@ -7,6 +7,7 @@ class PATHS
|
|||
public:
|
||||
static wxString GetUserScriptingPath();
|
||||
static wxString GetUserTemplatesPath();
|
||||
static wxString GetDefaultUserProjectsPath();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -38,6 +38,7 @@
|
|||
#include <wildcards_and_files_ext.h>
|
||||
#include <kiplatform/environment.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <paths.h>
|
||||
|
||||
#include "project_tree_item.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.
|
||||
if( curr_dir.IsEmpty() || !wxFileName::DirExists( curr_dir ) )
|
||||
curr_dir = wxStandardPaths::Get().GetDocumentsDir();
|
||||
curr_dir = PATHS::GetDefaultUserProjectsPath();
|
||||
|
||||
if( !curr_dir.IsEmpty() )
|
||||
curr_dir += wxFileName::GetPathSeparator();
|
||||
|
@ -540,7 +541,7 @@ void PROJECT_TREE_PANE::ReCreateTreePrj()
|
|||
if( !fn.IsOk() )
|
||||
{
|
||||
fn.Clear();
|
||||
fn.SetPath( wxStandardPaths::Get().GetDocumentsDir() );
|
||||
fn.SetPath( PATHS::GetDefaultUserProjectsPath() );
|
||||
fn.SetName( NAMELESS_PROJECT );
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
prjReset = true;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <board.h>
|
||||
#include <track.h>
|
||||
#include <footprint.h>
|
||||
#include <paths.h>
|
||||
#include <dialog_gendrill.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <reporter.h>
|
||||
|
@ -422,7 +423,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
|
|||
defaultPath = Prj().AbsolutePath( defaultPath );
|
||||
|
||||
if( defaultPath.IsEmpty() )
|
||||
defaultPath = wxStandardPaths::Get().GetDocumentsDir();
|
||||
defaultPath = PATHS::GetDefaultUserProjectsPath();
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath, fn.GetFullName(),
|
||||
ReportFileWildcard(), wxFD_SAVE );
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <wx/wupdlock.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <paths.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/project_local_settings.h>
|
||||
#include <project/net_settings.h>
|
||||
|
@ -167,7 +168,7 @@ bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName, bo
|
|||
}
|
||||
else
|
||||
{
|
||||
path = wxStandardPaths::Get().GetDocumentsDir();
|
||||
path = PATHS::GetDefaultUserProjectsPath();
|
||||
// leave name empty
|
||||
}
|
||||
|
||||
|
@ -419,7 +420,7 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
|
|||
savePath = GetMruPath();
|
||||
|
||||
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
||||
savePath = wxStandardPaths::Get().GetDocumentsDir();
|
||||
savePath = PATHS::GetDefaultUserProjectsPath();
|
||||
}
|
||||
|
||||
wxFileName fn( savePath.GetPath(), orig_name, KiCadPcbFileExtension );
|
||||
|
@ -1040,7 +1041,7 @@ bool PCB_EDIT_FRAME::doAutoSave()
|
|||
|
||||
if( GetBoard()->GetFileName().IsEmpty() )
|
||||
{
|
||||
tmpFileName = wxFileName( wxStandardPaths::Get().GetDocumentsDir(), wxT( "noname" ),
|
||||
tmpFileName = wxFileName( PATHS::GetDefaultUserProjectsPath(), wxT( "noname" ),
|
||||
KiCadPcbFileExtension );
|
||||
GetBoard()->SetFileName( tmpFileName.GetFullPath() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue