forked from qt-creator/qt-creator
Fix for showInGraphicalShell. The api fails to open a dir if the path contains ..
Change-Id: If38b23563395509c61d9ec2e6b771bf4d2c54527 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -67,6 +67,7 @@ static void showGraphicalShellError(QWidget *parent, const QString &app, const Q
|
|||||||
|
|
||||||
void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
|
void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
|
||||||
{
|
{
|
||||||
|
const QFileInfo fileInfo(pathIn);
|
||||||
// Mac, Windows support folder or file.
|
// Mac, Windows support folder or file.
|
||||||
if (HostOsInfo::isWindowsHost()) {
|
if (HostOsInfo::isWindowsHost()) {
|
||||||
const FileName explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe"));
|
const FileName explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe"));
|
||||||
@@ -79,15 +80,15 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList param;
|
QStringList param;
|
||||||
if (!QFileInfo(pathIn).isDir())
|
if (!fileInfo.isDir())
|
||||||
param += QLatin1String("/select,");
|
param += QLatin1String("/select,");
|
||||||
param += QDir::toNativeSeparators(pathIn);
|
param += QDir::toNativeSeparators(fileInfo.canonicalFilePath());
|
||||||
QProcess::startDetached(explorer.toString(), param);
|
QProcess::startDetached(explorer.toString(), param);
|
||||||
} else if (HostOsInfo::isMacHost()) {
|
} else if (HostOsInfo::isMacHost()) {
|
||||||
QStringList scriptArgs;
|
QStringList scriptArgs;
|
||||||
scriptArgs << QLatin1String("-e")
|
scriptArgs << QLatin1String("-e")
|
||||||
<< QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"")
|
<< QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"")
|
||||||
.arg(pathIn);
|
.arg(fileInfo.canonicalFilePath());
|
||||||
QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs);
|
QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs);
|
||||||
scriptArgs.clear();
|
scriptArgs.clear();
|
||||||
scriptArgs << QLatin1String("-e")
|
scriptArgs << QLatin1String("-e")
|
||||||
@@ -95,7 +96,6 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
|
|||||||
QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs);
|
QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs);
|
||||||
} else {
|
} else {
|
||||||
// we cannot select a file here, because no file browser really supports it...
|
// we cannot select a file here, because no file browser really supports it...
|
||||||
const QFileInfo fileInfo(pathIn);
|
|
||||||
const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.filePath();
|
const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.filePath();
|
||||||
const QString app = UnixUtils::fileBrowser(ICore::settings());
|
const QString app = UnixUtils::fileBrowser(ICore::settings());
|
||||||
QProcess browserProc;
|
QProcess browserProc;
|
||||||
|
|||||||
@@ -115,7 +115,9 @@ Utils::FileName QmakeAndroidBuildApkStep::androidPackageSourceDir() const
|
|||||||
= pro->rootProjectNode()->findProFileFor(proFilePathForInputFile());
|
= pro->rootProjectNode()->findProFileFor(proFilePathForInputFile());
|
||||||
if (!node)
|
if (!node)
|
||||||
return Utils::FileName();
|
return Utils::FileName();
|
||||||
return Utils::FileName::fromString(node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir));
|
|
||||||
|
QFileInfo sourceDirInfo(node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir));
|
||||||
|
return Utils::FileName::fromString(sourceDirInfo.canonicalFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmakeAndroidBuildApkStep::ctor()
|
void QmakeAndroidBuildApkStep::ctor()
|
||||||
|
|||||||
Reference in New Issue
Block a user