common,eeschema,pcbnew: path cleanup

This commit is contained in:
Sylwester Kocjan 2022-10-30 09:17:35 +01:00 committed by Mark Roszko
parent e62f764678
commit a234d5a2c8
6 changed files with 13 additions and 20 deletions

View File

@ -24,7 +24,7 @@
#include <search_stack.h>
#include <systemdirsappend.h>
#include <wx/stdpaths.h>
#include <kiplatform/environment.h>
DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG( wxWindow* aParent,
@ -114,7 +114,7 @@ bool DIALOG_GLOBAL_LIB_TABLE_CONFIG::TransferDataToWindow()
if( !templatePath.IsEmpty() )
ss.AddPaths( templatePath, 0 );
else
templatePath = wxStandardPaths::Get().GetUserConfigDir();
templatePath = KIPLATFORM::ENV::GetUserConfigPath();
m_filePicker1->SetInitialDirectory( templatePath );

View File

@ -22,7 +22,7 @@
*/
#include <wx/log.h>
#include <wx/stdpaths.h>
#include <kiplatform/environment.h>
#include <pgm_base.h>
#include <confirm.h>
@ -206,7 +206,7 @@ const wxString PROJECT::libTableName( const wxString& aLibTableName ) const
// to be re-thought out.
#ifndef __WXMAC__
fn.AssignDir( wxStandardPaths::Get().GetUserConfigDir() );
fn.AssignDir( KIPLATFORM::ENV::GetUserConfigPath() );
#else
// don't pollute home folder, temp folder seems to be more appropriate
fn.AssignDir( wxStandardPaths::Get().GetTempDir() );

View File

@ -47,7 +47,7 @@
#include <wx/dirdlg.h>
#include <wx/msgdlg.h>
#include <wx/stdpaths.h>
#include <kiplatform/environment.h>
#include <wx/log.h>
@ -165,7 +165,7 @@ void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& even
// project path is not defined so point to the users document path to save the plot files.
if( Prj().IsNullProject() )
{
path = wxStandardPaths::Get().GetDocumentsDir();
path = KIPLATFORM::ENV::GetDocumentsPath();
}
else
{
@ -405,8 +405,7 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
wxString extMsg;
wxFileName fn;
extMsg.Printf( _( "Falling back to user path '%s'." ),
wxStandardPaths::Get().GetDocumentsDir() );
extMsg.Printf( _( "Falling back to user path '%s'." ), KIPLATFORM::ENV::GetDocumentsPath() );
// Build the absolute path of current output directory to preselect it in the file browser.
std::function<bool( wxString* )> textResolver =
@ -454,7 +453,7 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
dlg.SetExtendedMessage( extMsg );
dlg.ShowModal();
path = wxStandardPaths::Get().GetDocumentsDir();
path = KIPLATFORM::ENV::GetDocumentsPath();
}
}
else
@ -467,7 +466,7 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
dlg.ShowModal();
// Always fall back to user's document path if no other absolute path can be normalized.
path = wxStandardPaths::Get().GetDocumentsDir();
path = KIPLATFORM::ENV::GetDocumentsPath();
}
}
else
@ -490,7 +489,7 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
dlg.SetExtendedMessage( extMsg );
dlg.ShowModal();
path = wxStandardPaths::Get().GetDocumentsDir();
path = KIPLATFORM::ENV::GetDocumentsPath();
}
}

View File

@ -680,9 +680,7 @@ bool SCH_EDIT_FRAME::saveSchematicFile( SCH_SHEET* aSheet, const wxString& aSave
if( !IsWritable( schematicFileName ) )
return false;
wxStandardPaths& paths = wxStandardPaths::Get();
wxString tempFile = wxFileName::CreateTempFileName(
paths.GetTempDir() + wxFileName::GetPathSeparator() + wxT( "eeschema" ) );
wxString tempFile = wxFileName::CreateTempFileName( "eeschema" );
// Save
wxLogTrace( traceAutoSave, "Saving file " + schematicFileName.GetFullPath() );

View File

@ -293,9 +293,7 @@ bool PL_EDITOR_FRAME::SaveDrawingSheetFile( const wxString& aFullFileName )
{
if( !aFullFileName.IsEmpty() )
{
wxStandardPaths& paths = wxStandardPaths::Get();
wxString tempFile = wxFileName::CreateTempFileName(
paths.GetTempDir() + wxFileName::GetPathSeparator() + wxT( "pledit" ) );
wxString tempFile = wxFileName::CreateTempFileName( "pledit" );
try
{

View File

@ -1064,9 +1064,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
GetBoard()->SynchronizeNetsAndNetClasses();
}
wxStandardPaths& paths = wxStandardPaths::Get();
wxString tempFile = wxFileName::CreateTempFileName(
paths.GetTempDir() + wxFileName::GetPathSeparator() + wxT( "pcbnew" ) );
wxString tempFile = wxFileName::CreateTempFileName( "pcbnew" );
wxString upperTxt;
wxString lowerTxt;