From c085375531af76157097409bfe93f1124f824354 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 25 Oct 2020 16:56:22 -0400 Subject: [PATCH] Create color settings path if missing Fixes https://gitlab.com/kicad/code/kicad/-/issues/5274 --- common/settings/settings_manager.cpp | 10 ++++++++++ include/settings/settings_manager.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/settings/settings_manager.cpp b/common/settings/settings_manager.cpp index c832180420..ab3b8987c8 100644 --- a/common/settings/settings_manager.cpp +++ b/common/settings/settings_manager.cpp @@ -573,6 +573,16 @@ wxString SETTINGS_MANAGER::GetColorSettingsPath() path.AssignDir( GetUserSettingsPath() ); path.AppendDir( "colors" ); + if( !path.DirExists() ) + { + if( !wxMkdir( path.GetPath() ) ) + { + wxLogTrace( traceSettings, + "GetColorSettingsPath(): Path %s missing and could not be created!", + path.GetPath() ); + } + } + return path.GetPath(); } diff --git a/include/settings/settings_manager.h b/include/settings/settings_manager.h index eb1e6bc993..e3b81511f8 100644 --- a/include/settings/settings_manager.h +++ b/include/settings/settings_manager.h @@ -297,7 +297,7 @@ public: static bool IsSettingsPathValid( const wxString& aPath ); /** - * Returns the path where color scheme files are stored + * Returns the path where color scheme files are stored; creating it if missing * (normally ./colors/ under the user settings path) */ static wxString GetColorSettingsPath();