TDirectory::GetFiles listing ignoring case on iOS (FMX, C++)

  

The code below lists files that have extension .cfg and it works fine on Win32. But, on iOS if i have a file that a user named with caps for the extension (e.g. test.CFG) then i miss it. I found this post using Delphi that might work using TDirectory::TFilterPredicate but i don’t know how to implement in C++Builder.

TStringDynArray list;
TSearchOption searchOption;
UnicodeString DocsPath;
int lenDocsFolder;

DocsPath = System::Ioutils::TPath::GetDocumentsPath();
lenDocsFolder = DocsPath.Length();
searchOption = TSearchOption::soTopDirectoryOnly;
try
{
list = TDirectory::GetFiles(DocsPath, “*.cfg”, searchOption);
}
catch (…)
{
ShowMessage(“Incorrect path or search mask”);
return;
}

I suppose i can just run a *.cfg block of code followed by a *.CFG but i’m hoping there is a cleaner approach.

Comments are closed.