forked from qt-creator/qt-creator
PathChooser: Provide static way to expand a directory...
...to be able to fetch working directory even for non-active targets. Change-Id: I563e9b56e8a8393b998811e0fb364078d4c37d03 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -330,6 +330,20 @@ FileName PathChooser::fileName() const
|
||||
return FileName::fromString(path());
|
||||
}
|
||||
|
||||
// FIXME: try to remove again
|
||||
QString PathChooser::expandedDirectory(const QString &input, const Environment &env,
|
||||
const QString &baseDir)
|
||||
{
|
||||
if (input.isEmpty())
|
||||
return input;
|
||||
const QString path = QDir::cleanPath(env.expandVariables(input));
|
||||
if (path.isEmpty())
|
||||
return path;
|
||||
if (!baseDir.isEmpty() && QFileInfo(path).isRelative())
|
||||
return QFileInfo(baseDir + QLatin1Char('/') + path).absoluteFilePath();
|
||||
return path;
|
||||
}
|
||||
|
||||
void PathChooser::setPath(const QString &path)
|
||||
{
|
||||
d->m_lineEdit->setText(QDir::toNativeSeparators(path));
|
||||
|
||||
Reference in New Issue
Block a user