diff src/core/config.cc @ 250:c130f47f6f48

*: many many changes e.g. the search page is actually implemented now!
author Paper <paper@paper.us.eu.org>
date Sun, 04 Feb 2024 21:17:17 -0500
parents d030b30526d5
children 862d0d8619f6
line wrap: on
line diff
--- a/src/core/config.cc	Wed Jan 24 20:18:59 2024 -0500
+++ b/src/core/config.cc	Sun Feb 04 21:17:17 2024 -0500
@@ -23,6 +23,8 @@
 #include <QFile>
 #include <QTextStream>
 
+#include <iostream>
+
 /* I'll use an INI-based config file instead of using an
  * XML file like Taiga.
  *
@@ -89,14 +91,16 @@
 		}
 	}
 
+	locale.RefreshAvailableLocales();
 	locale.SetActiveLocale(QLocale(Strings::ToQString(INI::GetIniValue<std::string>(ini, "General", "Locale", "en_US"))));
 
 	theme.SetTheme(Translate::ToTheme(INI::GetIniValue<std::string>(ini, "Appearance", "Theme", "Default")));
 
 	{
 		std::vector<std::string> v = Strings::Split(INI::GetIniValue<std::string>(ini, "Library", "Folders", ""), ";");
-		library.paths = std::set(std::make_move_iterator(v.begin()),
-								 std::make_move_iterator(v.end()));
+		for (const auto& s : v)
+			if (!library.paths.count(s))
+				library.paths.insert(s);
 	}
 
 	library.real_time_monitor = INI::GetIniValue<bool>(ini, "Library", "Real-time monitor", true);
@@ -104,7 +108,7 @@
 	return 0;
 }
 
-int Config::Save() const {
+int Config::Save() {
 	std::filesystem::path cfg_path = Filesystem::GetConfigPath();
 	Filesystem::CreateDirectories(cfg_path);