Improve file treversing for fat systems (can now handle case insensitive) and fixed creating new nodes which may conflict with short name
Related issue
Fixes #95
Changes
Added treverse_dir in Filesystem which allow the filesystem to control specific treversing if needed (it has default implementation)
When creating new nodes in FAT, it will check the long and short name, if long name doesn't conflict but short name does (due to name truncation), we will increment the ~1 number at the end until it doesn't conflict.
There might be a bug here, not sure easily triggerable. if lets say we have FILE~2, and then some entries, then FILE~1, then some entries, if you try to insert the file FILE.... that will not match the long name for either of these, but will match the short name.
The issue is that during insertion, when it gets to FILE~2 it will not match short or long name (because it start with FILE~1, then when it reach FILE~1 it will be incremented to FILE~2 and will be inserted after FILE~1.
In order to get to the state where FILE~2 comes before FILE~1, I'm not sure how it can be done
Checklist
[x] The changes are tested and works as expected (mention if not) (mentioned issue)
Summary
Improve file treversing for fat systems (can now handle case insensitive) and fixed creating new nodes which may conflict with short name
Related issue
Fixes #95
Changes
treverse_dir
inFilesystem
which allow the filesystem to control specific treversing if needed (it has default implementation)FAT
, it will check the long and short name, if long name doesn't conflict but short name does (due to name truncation), we will increment the~1
number at the end until it doesn't conflict.FILE~2
, and then some entries, thenFILE~1
, then some entries, if you try to insert the fileFILE....
that will not match the long name for either of these, but will match the short name. The issue is that during insertion, when it gets toFILE~2
it will not match short or long name (because it start withFILE~1
, then when it reachFILE~1
it will be incremented toFILE~2
and will be inserted afterFILE~1
. In order to get to the state whereFILE~2
comes beforeFILE~1
, I'm not sure how it can be doneChecklist