Skip to content

Commit 20b5084

Browse files
committed
more optimizations lol
1 parent 5316d4e commit 20b5084

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Encore/src/song/songlist.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,11 @@ void SongList::ScanFolder(const std::filesystem::path &folder) {
186186
if (std::filesystem::exists(infoPath)) {
187187
song.songInfoPath = (folder / "info.json");
188188
song.songDir = folder.string();
189-
if (std::filesystem::exists(folder / "cover.png")) {
190-
song.albumArtPath = (folder / "cover.png").string();
191-
}
192-
if (std::filesystem::exists(folder / "cover.jpg")) {
193-
song.albumArtPath = (folder / "cover.jpg").string();
194-
}
195-
if (std::filesystem::exists(folder / "cover.jpeg")) {
196-
song.albumArtPath = (folder / "cover.jpeg").string();
189+
for (auto &file : std::filesystem::directory_iterator(folder)) {
190+
if (file.path().stem() == "cover") {
191+
song.albumArtPath = file.path().string();
192+
break;
193+
}
197194
}
198195
song.LoadSongJSON(song.songInfoPath);
199196
} else if (std::filesystem::exists(folder / "song.ini")) {

0 commit comments

Comments
 (0)