Skip to content

Commit 144aed4

Browse files
committed
Rename flag. Turn on UTF-8 and flag on unix
Also added label portion to the test.
1 parent 1197394 commit 144aed4

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

lib/oofatfs/ffunicode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ DWORD ff_wtoupper ( /* Returns up-converted code point */
499499
DWORD uni /* Unicode code point to be up-converted */
500500
)
501501
{
502-
#if FF_FS_ASCII_UPPER_ONLY
502+
#if FF_FS_CASE_INSENSITIVE_COMPARISON_ASCII_ONLY
503503
// Only uppercase ASCII characters. Everything else will require the user to
504504
// pass in an uppercase version.
505505
if ('a' <= uni && uni <= 'z') {

ports/unix/mpconfigport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@
178178
#define MICROPY_FATFS_RPATH (2)
179179
#define MICROPY_FATFS_MAX_SS (4096)
180180
#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
181+
#define MICROPY_FATFS_LFN_UNICODE (2)
182+
183+
#define FF_FS_CASE_INSENSITIVE_COMPARISON_ASCII_ONLY (1)
181184

182185
// Define to MICROPY_ERROR_REPORTING_DETAILED to get function, etc.
183186
// names in exception messages (may require more RAM).

py/circuitpy_mpconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ void supervisor_run_background_tasks_if_tick(void);
595595
#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (0)
596596
#endif
597597

598-
#define FF_FS_ASCII_UPPER_ONLY (1)
598+
#define FF_FS_CASE_INSENSITIVE_COMPARISON_ASCII_ONLY (1)
599599

600600
#define FF_FS_MAKE_VOLID (1)
601601

tests/extmod/vfs_fat_case.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,29 @@ def ioctl(self, op, arg):
5151
uos.mount(vfs, "/ramdisk")
5252
uos.chdir("/ramdisk")
5353

54+
vfs.label = "labelæ"
55+
# This label would normally be LABELÆ but our limited upper casing does "LABELæ"
56+
print(vfs.label)
57+
5458
# Check ASCII case-insensitivity
55-
vfs.mkdir("foo_dir_az")
59+
vfs.mkdir("fooaz")
60+
print(uos.listdir(""))
61+
vfs.rmdir("fOOAZ")
62+
63+
# Check ASCII case-insensitivity for long names (8+ characters)
64+
vfs.mkdir("123456789fooaz")
5665
print(uos.listdir(""))
57-
vfs.rmdir("fOO_dir_AZ")
66+
vfs.rmdir("123456789fOOAZ")
5867

5968
# Characters outside of a-z are case sensitive.
6069
vfs.mkdir("extended_æ")
6170
print(uos.listdir(""))
71+
# Normally this would work ok. With our limited uppercasing, it won't.
6272
try:
6373
vfs.rmdir("extended_Æ")
6474
except OSError as e:
6575
print(e.errno == uerrno.ENOENT)
76+
6677
vfs.rmdir("extended_æ")
6778

6879
# Emoji test for fun.

tests/extmod/vfs_fat_case.py.exp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
['foo_dir_az']
1+
LABELæ
2+
['fooaz']
3+
['123456789fooaz']
24
['extended_æ']
35
True

0 commit comments

Comments
 (0)