Skip to content

Playlist: Don't stop scanning at file names that can't be converted - #1060

Open
Coastrnaut wants to merge 1 commit into
projectM-visualizer:masterfrom
Coastrnaut:fix/playlist-unicode-filenames
Open

Coastrnaut wants to merge 1 commit into
projectM-visualizer:masterfrom
Coastrnaut:fix/playlist-unicode-filenames

Conversation

@Coastrnaut

@Coastrnaut Coastrnaut commented Nov 8, 2026 •

Copy link
Copy Markdown

Fixes #962

Problem

On Windows, path::string() converts to the active ANSI code page and throws if a file name contains characters outside of it (e.g. ⚠ or Cyrillic letters on a Western European system).

  • In recursive mode, the exception aborted the scan, and every file after the offending one was silently dropped.
  • In non-recursive mode, the exception escaped AddPath() entirely.

Change

  • Files whose names can't be converted are now skipped one by one and the scan continues. They can't be loaded through the narrow-string API anyway. Full UTF-8 path support on Windows would need API changes, so this PR doesn't attempt it.
  • Fixed a second bug found while testing: when inserting at an index, AddPath() shifted the playback history indices a second time, although AddItem() already does this for each added item. A history entry that should move from 0 to 3 ended up at 6.
  • C++14 compatible, and works with both std::filesystem and Boost.Filesystem. It doesn't use u8string().

Tests

  • 3 new tests in PlaylistTest.cpp, using a new data/presets-unicode folder that contains B_⚠_Warning.milk. All three fail on master and pass with this change. Playlist suite: 101/101.
  • Scanned the 4 official preset repos (cream-of-the-crop, en-d, milkdrop-original, projectm-classic) with master's and this branch's Playlist code, every folder recursively and non-recursively. Both produced identical playlists: 27,078 items in the same order.

Retested on current master (2026-11-12)

On Windows, path::string() converts to the active ANSI code page and
throws if a file name contains characters outside of it (e.g. U+26A0
or Cyrillic letters on a Western European system). In recursive mode,
the exception aborted the scan and silently dropped all files after it,
in non-recursive mode it escaped AddPath() entirely. Such files are now
skipped individually and the scan continues.

Also fix AddPath() shifting the playback history indices twice when
inserting at an index: AddItem() already does this for each added item.

Fixes projectM-visualizer#962

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DEV BUG] Preset playlist parser stops when it contains random/cyrillic characters

1 participant