Skip to content

Commit dfbbc07

Browse files
committed
Core (LV::Video): Account for wide-character paths on Windows.
1 parent d6b5374 commit dfbbc07

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

libvisual/libvisual/lv_video.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ namespace LV {
7979
// TODO: Factor this out into a string utility library
8080
std::string to_lower_ascii (std::string const& s)
8181
{
82-
std::string result {s};
83-
std::transform (result.begin (), result.end (), result.begin (),
84-
[=] (unsigned char c) { return std::tolower (c); });
82+
auto result {s};
83+
for (auto& c : result)
84+
c = std::tolower (c);
8585
return result;
8686
}
8787

@@ -295,9 +295,10 @@ namespace LV {
295295

296296
bool Video::save_to_file (std::string const& path) const
297297
{
298-
std::string extension {to_lower_ascii (fs::path {path}.extension ())};
298+
auto extension {fs::path {path}.extension ()};
299+
auto extension_lower (to_lower_ascii (extension.string ()));
299300

300-
auto entry {bitmap_format_extension_map.find (extension)};
301+
auto entry {bitmap_format_extension_map.find (extension_lower)};
301302
if (entry == bitmap_format_extension_map.end ()) {
302303
visual_log (VISUAL_LOG_ERROR, "Could not deduce format from filename (%s)", path.c_str ());
303304
return false;

0 commit comments

Comments
 (0)