From 6442ad581ede38d75613e8c2c54591bda790fefd Mon Sep 17 00:00:00 2001 From: Furgo <148809153+furgo16@users.noreply.github.com> Date: Sat, 1 Mar 2025 09:53:17 +0100 Subject: [PATCH] Move CustomFolder parameter migration to more appropriate location --- src/Mod/Start/Gui/StartView.cpp | 9 --------- src/Mod/Start/StartMigrator.py | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Mod/Start/Gui/StartView.cpp b/src/Mod/Start/Gui/StartView.cpp index e398c142ae..2ff0689e9d 100644 --- a/src/Mod/Start/Gui/StartView.cpp +++ b/src/Mod/Start/Gui/StartView.cpp @@ -194,15 +194,6 @@ StartView::StartView(QWidget* parent) auto cardSpacing = hGrp->GetInt("FileCardSpacing", 15); // NOLINT auto showExamples = hGrp->GetBool("ShowExamples", true); // NOLINT - // Migrate legacy property, can be removed in later releases - std::string legacyCustomFolder(hGrp->GetASCII("ShowCustomFolder", "")); - if (!legacyCustomFolder.empty()) { - hGrp->SetASCII("CustomFolder", legacyCustomFolder); - hGrp->RemoveASCII("ShowCustomFolder"); - Base::Console().Message("v1.1: renamed ShowCustomFolder parameter to CustomFolder\n"); - } - // End of migration code - // Verify that the folder specified in preferences is available before showing it std::string customFolder(hGrp->GetASCII("CustomFolder", "")); bool showCustomFolder = false; diff --git a/src/Mod/Start/StartMigrator.py b/src/Mod/Start/StartMigrator.py index 18c1476341..2b5480fe8f 100644 --- a/src/Mod/Start/StartMigrator.py +++ b/src/Mod/Start/StartMigrator.py @@ -57,6 +57,7 @@ class StartMigrator2024: self._remove_toolbars() self._remove_deprecated_parameters() self._mark_complete() + self._migrate_custom_folder() FreeCAD.Console.PrintMessage("done.\n") # If the old Start workbench was set as the Autoload Module, reconfigure it so the Start command is run at startup, @@ -99,19 +100,26 @@ class StartMigrator2024: if "WebWorkbench" in groups: tux_prefs.RemGroup("WebWorkbench") + # In FreeCAD 1.1, the custom folder parameter was renamed from "ShowCustomFolder" + # to "CustomFolder". The new parameter does not yet support multiple locations. + def _migrate_custom_folder(self): + custom_folder = self.start_prefs.GetString("ShowCustomFolder", "") + + # Note: multiple locations separated by ";;" are not supported at this time + # Use the first listed location and discard the rest + return custom_folder.split(";;")[0] + # Delete old Start preferences def _remove_deprecated_parameters(self): show_on_startup = self.start_prefs.GetBool("ShowOnStartup", True) show_examples = self.start_prefs.GetBool("ShowExamples", True) close_start = self.start_prefs.GetBool("closeStart", False) - custom_folder = self.start_prefs.GetString( - "ShowCustomFolder", "" - ) # Note: allow multiple locations separated by ";;" + custom_folder = self._migrate_custom_folder() self.start_prefs.Clear() self.start_prefs.SetBool("ShowOnStartup", show_on_startup) self.start_prefs.SetBool("ShowExamples", show_examples) self.start_prefs.SetBool("CloseStart", close_start) - self.start_prefs.SetString("ShowCustomFolder", custom_folder) + self.start_prefs.SetString("CustomFolder", custom_folder) # Indicate that this migration has been run def _mark_complete(self):