diff --git a/src/MenuLayer.cpp b/src/MenuLayer.cpp index 546baa6..6165e6b 100644 --- a/src/MenuLayer.cpp +++ b/src/MenuLayer.cpp @@ -122,15 +122,12 @@ class $modify(MenuLayerMLHook, MenuLayer) { std::string songArtist = Utils::getSongArtist(); int songID = Utils::getSongID(); std::string customSong = Utils::currentCustomSong(); + if (!std::filesystem::exists(m_fields->blacklistFile)) return log::info("error finding blacklist file!"); if (!useCustomSongs) toWriteToFile = toWriteToFile.append(fmt::format(" # Song: {} by {}", songName, songArtist)); - auto test = utils::file::readString(m_fields->blacklistFile); - if (test.isErr()) return log::info("error reading blacklist file!"); - auto newLine = geode::utils::file::writeString(m_fields->blacklistFile, test.unwrap().append("\n")); - if (newLine.isErr()) return log::info("error writing blacklist file!"); - auto readAfterNewLine = geode::utils::file::readString(m_fields->blacklistFile); - if (readAfterNewLine.isErr()) return log::info("error reading blacklist file!"); - auto result = geode::utils::file::writeString(m_fields->blacklistFile, readAfterNewLine.unwrap().append(toWriteToFile)); - if (result.isErr()) return log::info("error blacklisting song {}", currentSong); + std::ofstream blacklistFileOutput; + blacklistFileOutput.open(m_fields->blacklistFile, std::ios_base::app); + blacklistFileOutput << std::endl << toWriteToFile; + blacklistFileOutput.close(); m_fields->songManager.addToBlacklist(); m_fields->songManager.clearSongs(); Utils::populateVector(useCustomSongs);