Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/playlist/Playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ auto Playlist::AddPath(const std::string& path, uint32_t index, bool recursive,

if (recursive)
{
try
for (const auto& entry : recursive_directory_iterator(path))
{
for (const auto& entry : recursive_directory_iterator(path))
try
{
if (is_regular_file(entry) && entry.path().extension() == ".milk")
{
Expand All @@ -106,17 +106,17 @@ auto Playlist::AddPath(const std::string& path, uint32_t index, bool recursive,
{
currentIndex = index + presetsAdded;
}
if (AddItem(entry.path().string(), currentIndex, allowDuplicates))
if (AddItem(entry.path().u8string(), currentIndex, allowDuplicates))
Copy link
Member

@kblaschke kblaschke Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u8string() is a C++20 extension. Currently, projectM has a guarantee to compile with C++14 or higher for maximum compatibility, so this function can't be used as of now. Additionally, boost::filesystem doesn't implement this method either.

If you can implement a fix that uses u8string() when the user actively uses C++20 with the STL std::filesystem implementation, but provide a C++14-compatible/Boost fallback that does the same, it can be merged.

{
presetsAdded++;
}
}
}
}
catch (std::exception&)
{
// Todo: Add failure feedback
return presetsAdded;
catch (std::exception&)
{
// Todo: Add failure feedback
continue;
}
}
}
else
Expand All @@ -130,7 +130,7 @@ auto Playlist::AddPath(const std::string& path, uint32_t index, bool recursive,
{
currentIndex = index + presetsAdded;
}
if (AddItem(entry.path().string(), currentIndex, allowDuplicates))
if (AddItem(entry.path().u8string(), currentIndex, allowDuplicates))
{
presetsAdded++;
}
Expand Down Expand Up @@ -222,8 +222,8 @@ void Playlist::Sort(uint32_t startIndex, uint32_t count,
break;

case SortPredicate::FilenameOnly: {
leftFilename = path(left.Filename()).filename().string();
rightFilename = path(right.Filename()).filename().string();
leftFilename = path(left.Filename()).filename().u8string();
rightFilename = path(right.Filename()).filename().u8string();
break;
}
}
Expand Down
Loading