case sensitive patch (Extrems)

This commit is contained in:
tantricity 2011-06-21 03:49:56 +00:00
parent 6407426a76
commit a7307e0c0e
2 changed files with 14 additions and 5 deletions

View File

@ -204,6 +204,8 @@ static int _FAT_directory_mbsncasecmp (const char* s1, const char* s2, size_t le
static bool _FAT_directory_entryGetAlias (const u8* entryData, char* destName) {
char c;
bool caseInfo;
int i = 0;
int j = 0;
@ -219,14 +221,18 @@ static bool _FAT_directory_entryGetAlias (const u8* entryData, char* destName) {
}
} else {
// Copy the filename from the dirEntry to the string
caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_BASE;
for (i = 0; (i < 8) && (entryData[DIR_ENTRY_name + i] != ' '); i++) {
destName[i] = entryData[DIR_ENTRY_name + i];
c = entryData[DIR_ENTRY_name + i];
destName[i] = (caseInfo ? tolower(c) : c);
}
// Copy the extension from the dirEntry to the string
if (entryData[DIR_ENTRY_extension] != ' ') {
destName[i++] = '.';
caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_EXT;
for ( j = 0; (j < 3) && (entryData[DIR_ENTRY_extension + j] != ' '); j++) {
destName[i++] = entryData[DIR_ENTRY_extension + j];
c = entryData[DIR_ENTRY_extension + j];
destName[i++] = (caseInfo ? tolower(c) : c);
}
}
destName[i] = '\0';

View File

@ -57,6 +57,9 @@
#define ATTRIB_HID 0x02 // Hidden
#define ATTRIB_RO 0x01 // Read only
#define CASE_LOWER_EXT 0x10 // WinNT lowercase extension
#define CASE_LOWER_BASE 0x08 // WinNT lowercase basename
typedef enum {FT_DIRECTORY, FT_FILE} FILE_TYPE;
typedef struct {
@ -77,7 +80,7 @@ enum DIR_ENTRY_offset {
DIR_ENTRY_name = 0x00,
DIR_ENTRY_extension = 0x08,
DIR_ENTRY_attributes = 0x0B,
DIR_ENTRY_reserved = 0x0C,
DIR_ENTRY_caseInfo = 0x0C,
DIR_ENTRY_cTime_ms = 0x0D,
DIR_ENTRY_cTime = 0x0E,
DIR_ENTRY_cDate = 0x10,