From 363aa2befba3f624e85a3ace151c29df8a4dbaff Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Mon, 23 Feb 2026 02:41:35 +0300 Subject: [PATCH] Use native separators in stock paths. --- common/paths.cpp | 63 ++++++++++++++++------------- common/settings/common_settings.cpp | 30 +++----------- 2 files changed, 41 insertions(+), 52 deletions(-) diff --git a/common/paths.cpp b/common/paths.cpp index 53f6225bc4..31f3e7346a 100644 --- a/common/paths.cpp +++ b/common/paths.cpp @@ -296,71 +296,78 @@ wxString PATHS::GetStockEDALibraryPath() wxString PATHS::GetStockSymbolsPath() { - wxString path; + wxFileName fn; + + fn.AssignDir( GetStockEDALibraryPath() ); + fn.AppendDir( "symbols" ); - path = GetStockEDALibraryPath() + wxT( "/symbols" ); - - return path; + return fn.GetPathWithSep(); } wxString PATHS::GetStockFootprintsPath() { - wxString path; + wxFileName fn; + + fn.AssignDir( GetStockEDALibraryPath() ); + fn.AppendDir( "footprints" ); - path = GetStockEDALibraryPath() + wxT( "/footprints" ); - - return path; + return fn.GetPathWithSep(); } wxString PATHS::GetStockDesignBlocksPath() { - wxString path; + wxFileName fn; + + fn.AssignDir( GetStockEDALibraryPath() ); + fn.AppendDir( "blocks" ); - path = GetStockEDALibraryPath() + wxT( "/blocks" ); - - return path; + return fn.GetPathWithSep(); } wxString PATHS::GetStock3dmodelsPath() { - wxString path; + wxFileName fn; + + fn.AssignDir( GetStockEDALibraryPath() ); + fn.AppendDir( "3dmodels" ); - path = GetStockEDALibraryPath() + wxT( "/3dmodels" ); - - return path; + return fn.GetPathWithSep(); } wxString PATHS::GetStockScriptingPath() { - wxString path; + wxFileName fn; + + fn.AssignDir( GetStockDataPath() ); + fn.AppendDir( "scripting" ); - path = GetStockDataPath() + wxT( "/scripting" ); - - return path; + return fn.GetPathWithSep(); } wxString PATHS::GetStockTemplatesPath() { - wxString path; + wxFileName fn; + + fn.AssignDir( GetStockEDALibraryPath() ); + fn.AppendDir( "template" ); - path = GetStockEDALibraryPath() + wxT( "/template" ); - - return path; + return fn.GetPathWithSep(); } wxString PATHS::GetLocaleDataPath() { - wxString path; + wxFileName fn; + + fn.AssignDir( GetStockDataPath() ); + fn.AppendDir( "internat" ); - path = GetStockDataPath() + wxT( "/internat" ); - - return path; + return fn.GetPathWithSep(); } diff --git a/common/settings/common_settings.cpp b/common/settings/common_settings.cpp index febd715292..01225b7c64 100644 --- a/common/settings/common_settings.cpp +++ b/common/settings/common_settings.cpp @@ -810,31 +810,13 @@ void COMMON_SETTINGS::InitializeEnvironment() } }; - wxFileName basePath( PATHS::GetStockEDALibraryPath(), wxEmptyString ); - - wxFileName path( basePath ); - path.AppendDir( wxT( "footprints" ) ); - addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "FOOTPRINT_DIR" ) ), path.GetFullPath() ); - - path = basePath; - path.AppendDir( wxT( "3dmodels" ) ); - addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "3DMODEL_DIR" ) ), path.GetFullPath() ); - - addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "TEMPLATE_DIR" ) ), - PATHS::GetStockTemplatesPath() ); - + addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "FOOTPRINT_DIR" ) ), PATHS::GetStockFootprintsPath() ); + addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "3DMODEL_DIR" ) ), PATHS::GetStock3dmodelsPath() ); + addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "TEMPLATE_DIR" ) ), PATHS::GetStockTemplatesPath() ); addVar( wxT( "KICAD_USER_TEMPLATE_DIR" ), PATHS::GetUserTemplatesPath() ); - - addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ), - PATHS::GetDefault3rdPartyPath() ); - - path = basePath; - path.AppendDir( wxT( "symbols" ) ); - addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "SYMBOL_DIR" ) ), path.GetFullPath() ); - - path = basePath; - path.AppendDir( wxT( "blocks" ) ); - addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "DESIGN_BLOCK_DIR" ) ), path.GetFullPath() ); + addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ), PATHS::GetDefault3rdPartyPath() ); + addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "SYMBOL_DIR" ) ), PATHS::GetStockSymbolsPath() ); + addVar( ENV_VAR::GetVersionedEnvVarName( wxS( "DESIGN_BLOCK_DIR" ) ), PATHS::GetStockDesignBlocksPath() ); }