diff --git a/Directory.cxx b/Directory.cxx index d54e60728350e84c5a3acf191b513dbd320c1adb..b305fd7a10bb3793d3d29f8080ddb89d10dc7086 100644 --- a/Directory.cxx +++ b/Directory.cxx @@ -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