~ is a pattern char, matching empty string, and thus bar~ is interpreted
as pattern. Filename patternmatching uses case-insensitive matching, and
that is why the matching string is turned uppercase.
However, the returned match should not be uppercase. This is a bug in AROS
MatchNext routine (and thus was inherited to MorphOS, too). I've already
fixed this for MorphOS. Here's the fix, in case someone wants to backport
it for AROS:
/*
** This strcpy is necessary, because in case
** of empty ac->an_String("") fib_FileName would
** get parent directory name which it must not!
*/
#if 1
/*
** Only replace the name if it's empty or path.
** fixes the problem where ticked patterns got
** turned into uppercase ("test'#" -> TEST#).
** - Piru
*/
if (*ac->an_String == '\0' || FilePart(ac->an_String) != ac->an_String)
{
strcpy(ac->an_Info.fib_FileName, ac->an_String);
}
#else
strcpy(ac->an_Info.fib_FileName, ac->an_String);
#endif