Commit c37423b6 authored by Eike Ziller's avatar Eike Ziller
Browse files

Add file name and base name variants to file-kind variables.



Change-Id: I46b91fba5cf78a3e540c3a07baee3354265c977a
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent d3341b99
......@@ -42,6 +42,8 @@
static const char kFilePathPostfix[] = ":FilePath";
static const char kPathPostfix[] = ":Path";
static const char kFileNamePostfix[] = ":FileName";
static const char kFileBaseNamePostfix[] = ":FileBaseName";
namespace Core {
......@@ -124,12 +126,16 @@ void VariableManager::registerFileVariables(const QByteArray &prefix, const QStr
{
registerVariable(prefix + kFilePathPostfix, tr("%1: Full path including file name.").arg(heading));
registerVariable(prefix + kPathPostfix, tr("%1: Full path excluding file name.").arg(heading));
registerVariable(prefix + kFileNamePostfix, tr("%1: File name without including path.").arg(heading));
registerVariable(prefix + kFileBaseNamePostfix, tr("%1: File base name without path and suffix.").arg(heading));
}
bool VariableManager::isFileVariable(const QByteArray &variable, const QByteArray &prefix)
{
return variable == prefix + kFilePathPostfix
|| variable == prefix + kPathPostfix;
|| variable == prefix + kPathPostfix
|| variable == prefix + kFileNamePostfix
|| variable == prefix + kFileBaseNamePostfix;
}
QString VariableManager::fileVariableValue(const QByteArray &variable, const QByteArray &prefix,
......@@ -145,6 +151,10 @@ QString VariableManager::fileVariableValue(const QByteArray &variable, const QBy
return fileInfo.filePath();
else if (variable == prefix + kPathPostfix)
return fileInfo.path();
else if (variable == prefix + kFileNamePostfix)
return fileInfo.fileName();
else if (variable == prefix + kFileBaseNamePostfix)
return fileInfo.baseName();
return QString();
}
......
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