mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
check for initialization with an empty pattern (backport from old trunk)
This commit is contained in:
parent
9e27531c68
commit
2f0ab58544
@ -46,11 +46,10 @@
|
||||
namespace Poco {
|
||||
|
||||
|
||||
Glob::Glob(const std::string& pattern, int options):
|
||||
_pattern(pattern),
|
||||
_options(options)
|
||||
Glob::Glob(const std::string& pattern, int options)
|
||||
: _pattern(pattern), _options(options)
|
||||
{
|
||||
poco_assert (!_pattern.empty());
|
||||
poco_assert(!_pattern.empty());
|
||||
}
|
||||
|
||||
|
||||
@ -90,20 +89,21 @@ void Glob::glob(const Path& pathPattern, std::set<std::string>& files, int optio
|
||||
{
|
||||
Path pattern(pathPattern);
|
||||
pattern.makeDirectory(); // to simplify pattern handling later on
|
||||
Path base(pattern);
|
||||
Path absBase(base);
|
||||
absBase.makeAbsolute();
|
||||
// In case of UNC paths we must not pop the topmost directory
|
||||
// (which must not contain wildcards), otherwise collect() will fail
|
||||
// as one cannot create a DirectoryIterator with only a node name ("\\srv\").
|
||||
int minDepth = base.getNode().empty() ? 0 : 1;
|
||||
while (base.depth() > minDepth && base[base.depth() - 1] != "..")
|
||||
{
|
||||
base.popDirectory();
|
||||
absBase.popDirectory();
|
||||
Path base(pattern);
|
||||
Path absBase(base);
|
||||
absBase.makeAbsolute();
|
||||
// In case of UNC paths we must not pop the topmost directory
|
||||
// (which must not contain wildcards), otherwise collect() will fail
|
||||
// as one cannot create a DirectoryIterator with only a node name ("\\srv\").
|
||||
int minDepth = base.getNode().empty() ? 0 : 1;
|
||||
while (base.depth() > minDepth && base[base.depth() - 1] != "..")
|
||||
{
|
||||
base.popDirectory();
|
||||
absBase.popDirectory();
|
||||
}
|
||||
if (pathPattern.isDirectory()) options |= GLOB_DIRS_ONLY;
|
||||
collect(pattern, absBase, base, pathPattern[base.depth()], files, options);
|
||||
if (pathPattern.isDirectory())
|
||||
options |= GLOB_DIRS_ONLY;
|
||||
collect(pattern, absBase, base, pathPattern[base.depth()], files, options);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user