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();
if (!jdkLocation.isEmpty()) {
env.set("JAVA_HOME", jdkLocation.toUserOutput());
Utils::FileName binPath = jdkLocation;
binPath.appendPath("bin");
env.prependOrSetPath(binPath.toUserOutput());
env.prependOrSetPath(jdkLocation.pathAppended("bin").toUserOutput());
}
return env.toProcessEnvironment();
}

View File

@@ -591,9 +591,9 @@ void AndroidRunnerWorker::handleJdbWaiting()
auto jdbPath = AndroidConfigurations::currentConfig().openJDKLocation().pathAppended("bin");
if (Utils::HostOsInfo::isWindowsHost())
jdbPath.appendPath("jdb.exe");
jdbPath = jdbPath.pathAppended("jdb.exe");
else
jdbPath.appendPath("jdb");
jdbPath = jdbPath.pathAppended("jdb");
QStringList jdbArgs("-connect");
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)
{
Utils::FileName path = isGlobal ? globalPath() : projectPath();
const QString configFile = path.appendPath(Constants::SETTINGS_FILE_NAME).toString();
const Utils::FileName path = isGlobal ? globalPath() : projectPath();
const QString configFile = path.pathAppended(Constants::SETTINGS_FILE_NAME).toString();
if (QFile::exists(configFile))
return;
QDir().mkpath(path.parentDir().toString());
QDir().mkpath(path.toString());
if (!isGlobal) {
const Project *project = SessionManager::startupProject();
Utils::FileName possibleProjectConfig = project->rootProjectDirectory().appendPath(
Utils::FileName possibleProjectConfig = project->rootProjectDirectory().pathAppended(
Constants::SETTINGS_FILE_NAME);
if (possibleProjectConfig.exists()) {
// 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 no configuration is found create a global one (if it does not yet exist) and use it.
createStyleFileIfNeeded(true);
configFile = globalPath().appendPath(Constants::SETTINGS_FILE_NAME).toString();
configFile = globalPath().pathAppended(Constants::SETTINGS_FILE_NAME).toString();
}
fileName = assumedPathForConfig(configFile);
@@ -334,23 +334,23 @@ static std::string readFile(const QString &path)
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);
}
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);
}
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()
{
return styleForFile(globalPath().appendPath(Constants::SAMPLE_FILE_NAME), false);
return styleForFile(globalPath().pathAppended(Constants::SAMPLE_FILE_NAME), false);
}
} // namespace ClangFormat

View File

@@ -47,6 +47,7 @@
using namespace ProjectExplorer;
using namespace QtSupport;
using namespace Utils;
namespace {
@@ -232,8 +233,7 @@ QVector<CMakeToolChainData> extractToolChainsFromCache(const CMakeConfig &config
QList<void *> CMakeProjectImporter::examineDirectory(const Utils::FileName &importPath) const
{
qCInfo(cmInputLog()) << "Examining directory:" << importPath.toUserOutput();
Utils::FileName cacheFile = importPath;
cacheFile.appendPath("CMakeCache.txt");
const FileName cacheFile = importPath.pathAppended("CMakeCache.txt");
if (!cacheFile.exists()) {
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 bldDir = m_parameters.workDirectory;
const FileName topCMake = Utils::FileName(srcDir).appendPath("CMakeLists.txt");
const FileName topCMake = srcDir.pathAppended("CMakeLists.txt");
resetData();

View File

@@ -1599,8 +1599,7 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<ProKey, ProString> &ve
else
qt5 = true;
FileName mkspecFullPath = baseMkspecDir;
mkspecFullPath.appendPath(theSpec);
FileName mkspecFullPath = baseMkspecDir.pathAppended(theSpec);
// 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)
{
return QmlProjectFileFormat::parseProjectFile(
Utils::FileName::fromString(testDataDir).appendPath(name + ".qmlproject"), error);
Utils::FileName::fromString(testDataDir).pathAppended(name + ".qmlproject"), error);
}
void tst_FileFormat::testFileFilter()