Commit 35bc0f36 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

simplify exists() implementation

parent c31055b5
...@@ -2771,16 +2771,13 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction( ...@@ -2771,16 +2771,13 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
if (IoUtils::exists(file)) { if (IoUtils::exists(file)) {
return ProItem::ReturnTrue; return ProItem::ReturnTrue;
} }
//regular expression I guess int slsh = file.lastIndexOf(QLatin1Char('/'));
QString dirstr = currentDirectory(); QString fn = file.mid(slsh+1);
int slsh = file.lastIndexOf(m_option->dir_sep); if (fn.contains(QLatin1Char('*')) || fn.contains(QLatin1Char('?'))) {
if (slsh != -1) { QString dirstr = file.left(slsh+1);
dirstr = file.left(slsh+1); if (!QDir(dirstr).entryList(QStringList(fn)).isEmpty())
file = file.right(file.length() - slsh - 1);
}
if (file.contains(QLatin1Char('*')) || file.contains(QLatin1Char('?')))
if (!QDir(dirstr).entryList(QStringList(file)).isEmpty())
return ProItem::ReturnTrue; return ProItem::ReturnTrue;
}
return ProItem::ReturnFalse; return ProItem::ReturnFalse;
} }
......
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