From 24258b7707cff279312c02807400b351afa35ae2 Mon Sep 17 00:00:00 2001 From: RevenantX Date: Tue, 20 Oct 2020 01:51:55 +0300 Subject: [PATCH] fix for UTF-8 --- foo_cuefixer/foo_cuefixer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/foo_cuefixer/foo_cuefixer.cpp b/foo_cuefixer/foo_cuefixer.cpp index 2cacd2c..7395886 100644 --- a/foo_cuefixer/foo_cuefixer.cpp +++ b/foo_cuefixer/foo_cuefixer.cpp @@ -1,5 +1,4 @@ #include -#include DECLARE_COMPONENT_VERSION("CUE fixer", "1.23", "CUE Fixer by RevenantX"); VALIDATE_COMPONENT_FILENAME("foo_cuefixer.dll"); @@ -40,13 +39,19 @@ class playlist_cuefixer : public playlist_callback_static pfc::string fileDir(pfc::io::path::getParent(itemHandle->get_path())); pfc::string referencedFullPath(pfc::io::path::combine(fileDir, refField)); - - if(!PathFileExistsA(referencedFullPath.subString(7).c_str())) + const char* path = referencedFullPath.subString(7).c_str(); + int count = MultiByteToWideChar(CP_UTF8, 0, path, -1, nullptr, 0); + wchar_t* pathWide = new wchar_t[count]; + MultiByteToWideChar(CP_UTF8, 0, path, -1, pathWide, count); + + if(GetFileAttributesW(pathWide) == INVALID_FILE_ATTRIBUTES) { + delete pathWide; entriesToRemove->add_item(itemHandle); removeCount++; continue; } + delete pathWide; //check against added items for (t_size j = 0; j < addedItemsCount; j++)