Propely substr file names

This commit is contained in:
Pk11 2021-08-21 17:39:39 -05:00
parent 41849eeaf1
commit 2bc47b299d

View File

@ -147,7 +147,13 @@ void showDirectoryContents(std::vector<DirEntry> &dirContents, int fileOffset, i
if(entry->size == -1)
entry->size = getFileSize(entry->name.c_str());
font->print(0, i + 1, true, entry->name.substr(0, SCREEN_COLS), Alignment::left, pal);
int nameSize = 0;
for(int i = 0; i < SCREEN_COLS; nameSize++) {
if((entry->name[nameSize] & 0xC0) != 0x80)
i++;
}
font->print(0, i + 1, true, entry->name.substr(0, nameSize), Alignment::left, pal);
if (entry->name == "..") {
font->print(-1, i + 1, true, "(..)", Alignment::right, pal);
} else if (entry->isDirectory) {