Ensure user paths are created early

Fix #11962
This commit is contained in:
Marek Roszko 2022-07-05 20:47:29 -04:00
parent ff54b8c718
commit 7473528cf4
3 changed files with 7 additions and 4 deletions

View File

@ -341,7 +341,7 @@ wxString PATHS::GetDocumentationPath()
bool PATHS::EnsurePathExists( const wxString& aPath )
{
wxFileName path( aPath );
if( !path.Normalize() )
if( !path.MakeAbsolute() )
{
return false;
}
@ -360,6 +360,7 @@ bool PATHS::EnsurePathExists( const wxString& aPath )
void PATHS::EnsureUserPathsExist()
{
EnsurePathExists( GetUserCachePath() );
EnsurePathExists( GetUserPluginsPath() );
EnsurePathExists( GetUserPlugins3DPath() );
EnsurePathExists( GetUserScriptingPath() );
@ -428,7 +429,7 @@ wxString PATHS::GetOSXKicadDataDir()
wxString PATHS::getWindowsKiCadRoot()
{
wxFileName root( Pgm().GetExecutablePath() + wxT( "/../" ) );
root.Normalize();
root.MakeAbsolute();
return root.GetPathWithSep();
}

View File

@ -367,6 +367,10 @@ void PGM_BASE::sentryPrompt()
bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit )
{
// Just make sure we init precreate any folders early for later code
// In particular, the user cache path is the most likely to be hit by startup code
PATHS::EnsureUserPathsExist();
#ifdef KICAD_USE_SENTRY
sentryInit();
#endif

View File

@ -55,8 +55,6 @@ SETTINGS_MANAGER::SETTINGS_MANAGER( bool aHeadless ) :
m_migration_source(),
m_migrateLibraryTables( true )
{
PATHS::EnsureUserPathsExist();
// Check if the settings directory already exists, and if not, perform a migration if possible
if( !MigrateIfNeeded() )
{