Deleting directory with 'hidden' files (starting with '.') causes 'Illegal Access' error
Deleting a (nested) directory with any hidden files and or directories (created by MacOSX for example), is currently impossible. It will delete all 'non-hidden' files and then when attempting the delete the directory causes the Illegal Access error. The directory will still be on the file system, with no means to delete the 'hidden' files 'on device'. This is mostly a problem with drives connected to the 'internal' usb port.
Apparently FileManager::get_directory(...) doesn't return files which are hidden or start with ".". This makes perfect sense most of the time but when you are trying to delete a directory structure with hidden files they are left behind causing problems.
...
while (1) {
res = dir->get_entry(info);
if (res != FR_OK)
break;
if ((info.lfname[0] == '.') || (info.attrib & AM_HID))
continue; // skip files to be hidden.
if (matchPattern && (strlen(matchPattern) > 0) && !pattern_match(matchPattern, info.lfname, false)) {
continue;
}
target.append(new FileInfo(info));
}
...