Precompose unicode characters before displaying since HFS+ and APFS is using decomposed form

This commit is contained in:
Edward Li 2021-02-01 19:40:52 +08:00
parent 98c4343410
commit 94caf86d4d
2 changed files with 8 additions and 0 deletions

View File

@ -145,6 +145,10 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca
if (entry == NULL)
break;
std::string name(entry->d_name);
#ifdef __APPLE__
extern std::string os_PrecomposedString(std::string string);
name = os_PrecomposedString(name);
#endif
if (name == ".")
continue;
std::string child_path = path + "/" + name;

View File

@ -252,3 +252,7 @@ extern "C" void emu_set_mouse_position(int x, int y, int width, int height)
std::string os_Locale(){
return [[[NSLocale autoupdatingCurrentLocale] localeIdentifier] UTF8String];
}
std::string os_PrecomposedString(std::string string){
return [[[NSString stringWithUTF8String:string.c_str()] precomposedStringWithCanonicalMapping] UTF8String];
}