diff src/core/config.cc @ 135:0a458cb26ff4

filesystem: move to using std::filesystem after C++17 switch old compilers will croak compiling this, but it's not like we *really* need to support them (they probably croak compiling Qt as well)
author Paper <mrpapersonic@gmail.com>
date Thu, 09 Nov 2023 18:01:56 -0500
parents 275da698697d
children 6fdf0632c003
line wrap: on
line diff
--- a/src/core/config.cc	Thu Nov 09 13:53:04 2023 -0500
+++ b/src/core/config.cc	Thu Nov 09 18:01:56 2023 -0500
@@ -21,9 +21,9 @@
    XML file like Taiga. */
 
 int Config::Load() {
-	Filesystem::Path cfg_path = Filesystem::GetConfigPath();
+	std::filesystem::path cfg_path = Filesystem::GetConfigPath();
 
-	mINI::INIFile file(cfg_path.GetPath());
+	mINI::INIFile file(cfg_path.string());
 	mINI::INIStructure ini;
 	file.read(ini);
 
@@ -40,6 +40,8 @@
 
 	torrents.feed_link = INI::GetIniValue<std::string>(ini, "Torrents", "RSS feed", "https://www.tokyotosho.info/rss.php?filter=1,11&zwnj=0");
 
+	recognition.detect_media_players = INI::GetIniValue<bool>(ini, "Recognition", "Detect media players", true);
+
 	/* ew */
 	locale.SetActiveLocale(QLocale(Strings::ToQString(INI::GetIniValue<std::string>(ini, "General", "Locale", "en_US"))));
 
@@ -49,11 +51,10 @@
 }
 
 int Config::Save() const {
-	Filesystem::Path cfg_path = Filesystem::GetConfigPath();
-	if (!cfg_path.GetParent().Exists())
-		cfg_path.GetParent().CreateDirectories();
+	std::filesystem::path cfg_path = Filesystem::GetConfigPath();
+	Filesystem::CreateDirectories(cfg_path);
 
-	mINI::INIFile file(cfg_path.GetPath());
+	mINI::INIFile file(cfg_path.string());
 	mINI::INIStructure ini;
 
 	INI::SetIniValue(ini, "General", "Service", service);
@@ -73,7 +74,6 @@
 	INI::SetIniValue(ini, "Torrents", "RSS feed", torrents.feed_link);
 
 	INI::SetIniValue(ini, "Recognition", "Detect media players", recognition.detect_media_players);
-	//ini["Recognition"]["Detect streaming media"] = Strings::ToUtf8String(recognition.detect_streaming_media);
 
 	file.write(ini);