More FileName::pathAppended()

Change-Id: Ie20ec34ea9712b3ec49e6233b23cef84c2019f03
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2019-05-17 13:28:38 +02:00
parent 7729c81f02
commit 0595e67c82
7 changed files with 17 additions and 20 deletions

View File

@@ -1077,9 +1077,7 @@ QProcessEnvironment AndroidConfigurations::toolsEnvironment(const AndroidConfig
Utils::FileName jdkLocation = config.openJDKLocation(); Utils::FileName jdkLocation = config.openJDKLocation();
if (!jdkLocation.isEmpty()) { if (!jdkLocation.isEmpty()) {
env.set("JAVA_HOME", jdkLocation.toUserOutput()); env.set("JAVA_HOME", jdkLocation.toUserOutput());
Utils::FileName binPath = jdkLocation; env.prependOrSetPath(jdkLocation.pathAppended("bin").toUserOutput());
binPath.appendPath("bin");
env.prependOrSetPath(binPath.toUserOutput());
} }
return env.toProcessEnvironment(); return env.toProcessEnvironment();
} }

View File

@@ -591,9 +591,9 @@ void AndroidRunnerWorker::handleJdbWaiting()
auto jdbPath = AndroidConfigurations::currentConfig().openJDKLocation().pathAppended("bin"); auto jdbPath = AndroidConfigurations::currentConfig().openJDKLocation().pathAppended("bin");
if (Utils::HostOsInfo::isWindowsHost()) if (Utils::HostOsInfo::isWindowsHost())
jdbPath.appendPath("jdb.exe"); jdbPath = jdbPath.pathAppended("jdb.exe");
else else
jdbPath.appendPath("jdb"); jdbPath = jdbPath.pathAppended("jdb");
QStringList jdbArgs("-connect"); QStringList jdbArgs("-connect");
jdbArgs << QString("com.sun.jdi.SocketAttach:hostname=localhost,port=%1") jdbArgs << QString("com.sun.jdi.SocketAttach:hostname=localhost,port=%1")

View File

@@ -243,16 +243,16 @@ static clang::format::FormatStyle constructStyle(const QByteArray &baseStyle = Q
void createStyleFileIfNeeded(bool isGlobal) void createStyleFileIfNeeded(bool isGlobal)
{ {
Utils::FileName path = isGlobal ? globalPath() : projectPath(); const Utils::FileName path = isGlobal ? globalPath() : projectPath();
const QString configFile = path.appendPath(Constants::SETTINGS_FILE_NAME).toString(); const QString configFile = path.pathAppended(Constants::SETTINGS_FILE_NAME).toString();
if (QFile::exists(configFile)) if (QFile::exists(configFile))
return; return;
QDir().mkpath(path.parentDir().toString()); QDir().mkpath(path.toString());
if (!isGlobal) { if (!isGlobal) {
const Project *project = SessionManager::startupProject(); const Project *project = SessionManager::startupProject();
Utils::FileName possibleProjectConfig = project->rootProjectDirectory().appendPath( Utils::FileName possibleProjectConfig = project->rootProjectDirectory().pathAppended(
Constants::SETTINGS_FILE_NAME); Constants::SETTINGS_FILE_NAME);
if (possibleProjectConfig.exists()) { if (possibleProjectConfig.exists()) {
// Just copy th .clang-format if current project has one. // Just copy th .clang-format if current project has one.
@@ -296,7 +296,7 @@ static clang::format::FormatStyle styleForFile(Utils::FileName fileName, bool ch
if (configFile.isEmpty()) { if (configFile.isEmpty()) {
// If no configuration is found create a global one (if it does not yet exist) and use it. // If no configuration is found create a global one (if it does not yet exist) and use it.
createStyleFileIfNeeded(true); createStyleFileIfNeeded(true);
configFile = globalPath().appendPath(Constants::SETTINGS_FILE_NAME).toString(); configFile = globalPath().pathAppended(Constants::SETTINGS_FILE_NAME).toString();
} }
fileName = assumedPathForConfig(configFile); fileName = assumedPathForConfig(configFile);
@@ -334,23 +334,23 @@ static std::string readFile(const QString &path)
std::string currentProjectConfigText() std::string currentProjectConfigText()
{ {
const QString configPath = projectPath().appendPath(Constants::SETTINGS_FILE_NAME).toString(); const QString configPath = projectPath().pathAppended(Constants::SETTINGS_FILE_NAME).toString();
return readFile(configPath); return readFile(configPath);
} }
std::string currentGlobalConfigText() std::string currentGlobalConfigText()
{ {
const QString configPath = globalPath().appendPath(Constants::SETTINGS_FILE_NAME).toString(); const QString configPath = globalPath().pathAppended(Constants::SETTINGS_FILE_NAME).toString();
return readFile(configPath); return readFile(configPath);
} }
clang::format::FormatStyle currentProjectStyle() clang::format::FormatStyle currentProjectStyle()
{ {
return styleForFile(projectPath().appendPath(Constants::SAMPLE_FILE_NAME), false); return styleForFile(projectPath().pathAppended(Constants::SAMPLE_FILE_NAME), false);
} }
clang::format::FormatStyle currentGlobalStyle() clang::format::FormatStyle currentGlobalStyle()
{ {
return styleForFile(globalPath().appendPath(Constants::SAMPLE_FILE_NAME), false); return styleForFile(globalPath().pathAppended(Constants::SAMPLE_FILE_NAME), false);
} }
} // namespace ClangFormat } // namespace ClangFormat

View File

@@ -47,6 +47,7 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace QtSupport; using namespace QtSupport;
using namespace Utils;
namespace { namespace {
@@ -232,8 +233,7 @@ QVector<CMakeToolChainData> extractToolChainsFromCache(const CMakeConfig &config
QList<void *> CMakeProjectImporter::examineDirectory(const Utils::FileName &importPath) const QList<void *> CMakeProjectImporter::examineDirectory(const Utils::FileName &importPath) const
{ {
qCInfo(cmInputLog()) << "Examining directory:" << importPath.toUserOutput(); qCInfo(cmInputLog()) << "Examining directory:" << importPath.toUserOutput();
Utils::FileName cacheFile = importPath; const FileName cacheFile = importPath.pathAppended("CMakeCache.txt");
cacheFile.appendPath("CMakeCache.txt");
if (!cacheFile.exists()) { if (!cacheFile.exists()) {
qCDebug(cmInputLog()) << cacheFile.toUserOutput() << "does not exist, returning."; qCDebug(cmInputLog()) << cacheFile.toUserOutput() << "does not exist, returning.";

View File

@@ -416,7 +416,7 @@ void TeaLeafReader::extractData()
const FileName srcDir = m_parameters.sourceDirectory; const FileName srcDir = m_parameters.sourceDirectory;
const FileName bldDir = m_parameters.workDirectory; const FileName bldDir = m_parameters.workDirectory;
const FileName topCMake = Utils::FileName(srcDir).appendPath("CMakeLists.txt"); const FileName topCMake = srcDir.pathAppended("CMakeLists.txt");
resetData(); resetData();

View File

@@ -1599,8 +1599,7 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<ProKey, ProString> &ve
else else
qt5 = true; qt5 = true;
FileName mkspecFullPath = baseMkspecDir; FileName mkspecFullPath = baseMkspecDir.pathAppended(theSpec);
mkspecFullPath.appendPath(theSpec);
// qDebug() << "default mkspec is located at" << mkspecFullPath; // qDebug() << "default mkspec is located at" << mkspecFullPath;

View File

@@ -54,7 +54,7 @@ QString testDataDir = QLatin1String(SRCDIR "/data");
static QmlProjectItem *loadQmlProject(QString name, QString *error) static QmlProjectItem *loadQmlProject(QString name, QString *error)
{ {
return QmlProjectFileFormat::parseProjectFile( return QmlProjectFileFormat::parseProjectFile(
Utils::FileName::fromString(testDataDir).appendPath(name + ".qmlproject"), error); Utils::FileName::fromString(testDataDir).pathAppended(name + ".qmlproject"), error);
} }
void tst_FileFormat::testFileFilter() void tst_FileFormat::testFileFilter()