diff src/core/config.cc @ 231:69f4768a820c

chore: merge divergent branches
author Paper <paper@paper.us.eu.org>
date Sat, 13 Jan 2024 09:43:41 -0500
parents d030b30526d5
children c130f47f6f48
line wrap: on
line diff
--- a/src/core/config.cc	Sat Jan 13 09:42:02 2024 -0500
+++ b/src/core/config.cc	Sat Jan 13 09:43:41 2024 -0500
@@ -25,12 +25,15 @@
 
 /* I'll use an INI-based config file instead of using an
  * XML file like Taiga.
+ *
+ * It technically isn't to spec, because I'm making these case-sensitive.
+ * Boohoo.
 */
 
 int Config::Load() {
 	std::filesystem::path cfg_path = Filesystem::GetConfigPath();
 
-	mINI::INIFile file(cfg_path.string());
+	mINI::INIFile file(cfg_path.u8string());
 	mINI::INIStructure ini;
 	file.read(ini);
 
@@ -90,6 +93,14 @@
 
 	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()));
+	}
+
+	library.real_time_monitor = INI::GetIniValue<bool>(ini, "Library", "Real-time monitor", true);
+
 	return 0;
 }
 
@@ -131,6 +142,9 @@
 		}
 	}
 
+	INI::SetIniValue(ini, "Library", "Folders", Strings::Implode(library.paths, ";"));
+	INI::SetIniValue(ini, "Library", "Real-time monitor", library.real_time_monitor);
+
 	file.write(ini);
 
 	return 0;