Skip to content

Commit ee46da1

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

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libvisual/libvisual/lv_video.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ 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};
82+
auto result {s};
8383
std::transform (result.begin (), result.end (), result.begin (),
8484
[=] (unsigned char c) { return std::tolower (c); });
8585
return result;
@@ -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 {std::filesystem::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)