Created
December 5, 2014 23:57
-
-
Save archshift/2cff8b36d79238eb156b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/file_sys/directory_sdmc.cpp b/src/core/file_sys/directory_sdmc.cpp | |
index 60a197c..4fd6469 100644 | |
--- a/src/core/file_sys/directory_sdmc.cpp | |
+++ b/src/core/file_sys/directory_sdmc.cpp | |
@@ -44,12 +44,11 @@ u32 Directory_SDMC::Read(const u32 count, Entry* entries) { | |
WARN_LOG(FILESYS, "File %s: size=%llu dir=%d", filename.c_str(), file.size, file.isDirectory); | |
- // TODO(Link Mauve): use a proper conversion to UTF-16. | |
- for (size_t j = 0; j < FILENAME_LENGTH; ++j) { | |
- entry.filename[j] = filename[j]; | |
- if (!filename[j]) | |
- break; | |
- } | |
+ std::u16string converted_filename = Common::UTF8ToUTF16(filename); | |
+ int filename_size = std::min(converted_filename.size(), FILENAME_LENGTH - 1); | |
+ | |
+ memcpy(entry.filename, converted_filename.c_str(), filename_size); | |
+ entry.filename[filename_size + 1] = '\0'; | |
FileUtil::SplitFilename83(filename, entry.short_name, entry.extension); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment