Commit e4bba930 authored by Chuck Atkins's avatar Chuck Atkins

Directory: Make sure the /* suffix uses correct slashes

When applying the /* wildcard suffix to a directory, make sure the
direction of the slash getting appended is consistent with the other
slashes in the path, i.e. /foo/bar and /foo/bar/ become /foo/bar/* and
similarly \foo\bar and \foo\bar\ become \foo\bar\*.

Change-Id: I44fcf7e97be65923a37aaed615ba5f4012756893
parent c282e64f
......@@ -113,15 +113,24 @@ bool Directory::Load(const char* name)
#endif
char* buf;
size_t n = strlen(name);
if ( name[n - 1] == '/' )
if ( name[n - 1] == '/' || name[n - 1] == '\\' )
{
buf = new char[n + 1 + 1];
sprintf(buf, "%s*", name);
}
else
{
// Make sure the slashes in the wildcard suffix are consistent with the
// rest of the path
buf = new char[n + 2 + 1];
sprintf(buf, "%s/*", name);
if ( strchr(name, '\\') )
{
sprintf(buf, "%s\\*", name);
}
else
{
sprintf(buf, "%s/*", name);
}
}
struct _wfinddata_t data; // data of current file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment