forked from qt-creator/qt-creator
Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -165,21 +165,21 @@ static bool useProjectOverriddenSettings()
|
||||
return project ? project->namedSettings(Constants::OVERRIDE_FILE_ID).toBool() : false;
|
||||
}
|
||||
|
||||
static Utils::FileName globalPath()
|
||||
static Utils::FilePath globalPath()
|
||||
{
|
||||
return Utils::FileName::fromString(Core::ICore::userResourcePath());
|
||||
return Utils::FilePath::fromString(Core::ICore::userResourcePath());
|
||||
}
|
||||
|
||||
static Utils::FileName projectPath()
|
||||
static Utils::FilePath projectPath()
|
||||
{
|
||||
const Project *project = SessionManager::startupProject();
|
||||
if (project)
|
||||
return globalPath().pathAppended("clang-format/" + currentProjectUniqueId());
|
||||
|
||||
return Utils::FileName();
|
||||
return Utils::FilePath();
|
||||
}
|
||||
|
||||
static QString findConfig(Utils::FileName fileName)
|
||||
static QString findConfig(Utils::FilePath fileName)
|
||||
{
|
||||
QDir parentDir(fileName.parentDir().toString());
|
||||
while (!parentDir.exists(Constants::SETTINGS_FILE_NAME)
|
||||
@@ -193,7 +193,7 @@ static QString findConfig(Utils::FileName fileName)
|
||||
return parentDir.filePath(Constants::SETTINGS_FILE_ALT_NAME);
|
||||
}
|
||||
|
||||
static QString configForFile(Utils::FileName fileName, bool checkForSettings)
|
||||
static QString configForFile(Utils::FilePath fileName, bool checkForSettings)
|
||||
{
|
||||
QDir overrideDir;
|
||||
if (!checkForSettings || useProjectOverriddenSettings()) {
|
||||
@@ -211,14 +211,14 @@ static QString configForFile(Utils::FileName fileName, bool checkForSettings)
|
||||
return findConfig(fileName);
|
||||
}
|
||||
|
||||
QString configForFile(Utils::FileName fileName)
|
||||
QString configForFile(Utils::FilePath fileName)
|
||||
{
|
||||
return configForFile(fileName, true);
|
||||
}
|
||||
|
||||
Utils::FileName assumedPathForConfig(const QString &configFile)
|
||||
Utils::FilePath assumedPathForConfig(const QString &configFile)
|
||||
{
|
||||
Utils::FileName fileName = Utils::FileName::fromString(configFile);
|
||||
Utils::FilePath fileName = Utils::FilePath::fromString(configFile);
|
||||
return fileName.parentDir().pathAppended("test.cpp");
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ static clang::format::FormatStyle constructStyle(const QByteArray &baseStyle = Q
|
||||
|
||||
void createStyleFileIfNeeded(bool isGlobal)
|
||||
{
|
||||
const Utils::FileName path = isGlobal ? globalPath() : projectPath();
|
||||
const Utils::FilePath path = isGlobal ? globalPath() : projectPath();
|
||||
const QString configFile = path.pathAppended(Constants::SETTINGS_FILE_NAME).toString();
|
||||
|
||||
if (QFile::exists(configFile))
|
||||
@@ -252,7 +252,7 @@ void createStyleFileIfNeeded(bool isGlobal)
|
||||
QDir().mkpath(path.toString());
|
||||
if (!isGlobal) {
|
||||
const Project *project = SessionManager::startupProject();
|
||||
Utils::FileName possibleProjectConfig = project->rootProjectDirectory().pathAppended(
|
||||
Utils::FilePath possibleProjectConfig = project->rootProjectDirectory().pathAppended(
|
||||
Constants::SETTINGS_FILE_NAME);
|
||||
if (possibleProjectConfig.exists()) {
|
||||
// Just copy th .clang-format if current project has one.
|
||||
@@ -290,7 +290,7 @@ static QByteArray configBaseStyleName(const QString &configFile)
|
||||
.trimmed();
|
||||
}
|
||||
|
||||
static clang::format::FormatStyle styleForFile(Utils::FileName fileName, bool checkForSettings)
|
||||
static clang::format::FormatStyle styleForFile(Utils::FilePath fileName, bool checkForSettings)
|
||||
{
|
||||
QString configFile = configForFile(fileName, checkForSettings);
|
||||
if (configFile.isEmpty()) {
|
||||
@@ -313,7 +313,7 @@ static clang::format::FormatStyle styleForFile(Utils::FileName fileName, bool ch
|
||||
return constructStyle(configBaseStyleName(configFile));
|
||||
}
|
||||
|
||||
clang::format::FormatStyle styleForFile(Utils::FileName fileName)
|
||||
clang::format::FormatStyle styleForFile(Utils::FilePath fileName)
|
||||
{
|
||||
return styleForFile(fileName, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user