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:
@@ -79,7 +79,7 @@ private:
|
||||
Ui::ChangeSelectionDialog *m_ui;
|
||||
|
||||
QProcess *m_process = nullptr;
|
||||
Utils::FileName m_gitExecutable;
|
||||
Utils::FilePath m_gitExecutable;
|
||||
QProcessEnvironment m_gitEnvironment;
|
||||
ChangeCommand m_command = NoCommand;
|
||||
QStringListModel *m_changeModel = nullptr;
|
||||
|
||||
@@ -315,7 +315,7 @@ void QueryContext::start()
|
||||
m_progress.reportStarted();
|
||||
// Order: synchronous call to error handling if something goes wrong.
|
||||
VcsOutputWindow::appendCommand(
|
||||
m_process.workingDirectory(), Utils::FileName::fromString(m_binary), m_arguments);
|
||||
m_process.workingDirectory(), Utils::FilePath::fromString(m_binary), m_arguments);
|
||||
m_timer.start();
|
||||
m_process.start(m_binary, m_arguments);
|
||||
m_process.closeWriteChannel();
|
||||
|
||||
@@ -57,10 +57,10 @@ static inline QString detectApp(const char *defaultExe)
|
||||
if (!app.isEmpty() || !HostOsInfo::isWindowsHost())
|
||||
return app;
|
||||
// Windows: Use app.exe from git if it cannot be found.
|
||||
const FileName gitBinDir = GerritPlugin::gitBinDirectory();
|
||||
const FilePath gitBinDir = GerritPlugin::gitBinDirectory();
|
||||
if (gitBinDir.isEmpty())
|
||||
return QString();
|
||||
FileName path = gitBinDir.pathAppended(defaultApp);
|
||||
FilePath path = gitBinDir.pathAppended(defaultApp);
|
||||
if (path.exists())
|
||||
return path.toString();
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class FetchContext : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
FetchContext(const QSharedPointer<GerritChange> &change,
|
||||
const QString &repository, const Utils::FileName &git,
|
||||
const QString &repository, const Utils::FilePath &git,
|
||||
const GerritServer &server,
|
||||
FetchMode fm, QObject *parent = nullptr);
|
||||
~FetchContext() override;
|
||||
@@ -119,7 +119,7 @@ private:
|
||||
const QSharedPointer<GerritChange> m_change;
|
||||
const QString m_repository;
|
||||
const FetchMode m_fetchMode;
|
||||
const Utils::FileName m_git;
|
||||
const Utils::FilePath m_git;
|
||||
const GerritServer m_server;
|
||||
State m_state;
|
||||
QProcess m_process;
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
};
|
||||
|
||||
FetchContext::FetchContext(const QSharedPointer<GerritChange> &change,
|
||||
const QString &repository, const Utils::FileName &git,
|
||||
const QString &repository, const Utils::FilePath &git,
|
||||
const GerritServer &server,
|
||||
FetchMode fm, QObject *parent)
|
||||
: QObject(parent)
|
||||
@@ -375,7 +375,7 @@ void GerritPlugin::push()
|
||||
push(currentRepository());
|
||||
}
|
||||
|
||||
Utils::FileName GerritPlugin::gitBinDirectory()
|
||||
Utils::FilePath GerritPlugin::gitBinDirectory()
|
||||
{
|
||||
return GitPlugin::client()->gitBinDirectory();
|
||||
}
|
||||
@@ -389,7 +389,7 @@ QString GerritPlugin::branch(const QString &repository)
|
||||
void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
{
|
||||
// Locate git.
|
||||
const Utils::FileName git = GitPlugin::client()->vcsBinary();
|
||||
const Utils::FilePath git = GitPlugin::client()->vcsBinary();
|
||||
if (git.isEmpty()) {
|
||||
VcsBase::VcsOutputWindow::appendError(tr("Git is not available."));
|
||||
return;
|
||||
@@ -493,7 +493,7 @@ QString GerritPlugin::findLocalRepository(QString project, const QString &branch
|
||||
branchRegexp.reset(); // Oops.
|
||||
}
|
||||
for (const QString &repository : gitRepositories) {
|
||||
const QString fileName = Utils::FileName::fromString(repository).fileName();
|
||||
const QString fileName = Utils::FilePath::fromString(repository).fileName();
|
||||
if ((!branchRegexp.isNull() && branchRegexp->exactMatch(fileName))
|
||||
|| fileName == project) {
|
||||
// Perform a check on the branch.
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
bool initialize(Core::ActionContainer *ac);
|
||||
|
||||
static Utils::FileName gitBinDirectory();
|
||||
static Utils::FilePath gitBinDirectory();
|
||||
static QString branch(const QString &repository);
|
||||
void addToLocator(Core::CommandLocator *locator);
|
||||
void push(const QString &topLevel);
|
||||
|
||||
@@ -243,7 +243,7 @@ int GerritServer::testConnection()
|
||||
static GitClient *const client = GitPlugin::client();
|
||||
const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC);
|
||||
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
|
||||
QString(), FileName::fromString(curlBinary), arguments,
|
||||
QString(), FilePath::fromString(curlBinary), arguments,
|
||||
Core::ShellCommand::NoOutput);
|
||||
if (resp.result == SynchronousProcessResponse::Finished) {
|
||||
QString output = resp.stdOut();
|
||||
@@ -345,7 +345,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
|
||||
arguments << p.portFlag << QString::number(port);
|
||||
arguments << hostArgument() << "gerrit" << "version";
|
||||
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
|
||||
QString(), FileName::fromString(p.ssh), arguments,
|
||||
QString(), FilePath::fromString(p.ssh), arguments,
|
||||
Core::ShellCommand::NoOutput);
|
||||
QString stdOut = resp.stdOut().trimmed();
|
||||
stdOut.remove("gerrit version ");
|
||||
@@ -353,7 +353,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
|
||||
} else {
|
||||
const QStringList arguments = curlArguments() << (url(RestUrl) + versionUrlC);
|
||||
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
|
||||
QString(), FileName::fromString(curlBinary), arguments,
|
||||
QString(), FilePath::fromString(curlBinary), arguments,
|
||||
Core::ShellCommand::NoOutput);
|
||||
// REST endpoint for version is only available from 2.8 and up. Do not consider invalid
|
||||
// if it fails.
|
||||
|
||||
@@ -780,9 +780,9 @@ QString GitClient::findRepositoryForDirectory(const QString &directory) const
|
||||
return QString();
|
||||
// QFileInfo is outside loop, because it is faster this way
|
||||
QFileInfo fileInfo;
|
||||
FileName parent;
|
||||
for (FileName dir = FileName::fromString(directory); !dir.isEmpty(); dir = dir.parentDir()) {
|
||||
const FileName gitName = dir.pathAppended(GIT_DIRECTORY);
|
||||
FilePath parent;
|
||||
for (FilePath dir = FilePath::fromString(directory); !dir.isEmpty(); dir = dir.parentDir()) {
|
||||
const FilePath gitName = dir.pathAppended(GIT_DIRECTORY);
|
||||
if (!gitName.exists())
|
||||
continue; // parent might exist
|
||||
fileInfo.setFile(gitName.toString());
|
||||
@@ -2340,7 +2340,7 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
|
||||
}
|
||||
|
||||
Environment sysEnv = Environment::systemEnvironment();
|
||||
const FileName exec = sysEnv.searchInPath("gitk");
|
||||
const FilePath exec = sysEnv.searchInPath("gitk");
|
||||
|
||||
if (!exec.isEmpty() && tryLauchingGitK(env, workingDirectory, fileName,
|
||||
exec.parentDir().toString())) {
|
||||
@@ -2377,7 +2377,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
arguments.append(QtcProcess::splitArgs(gitkOpts, HostOsInfo::hostOs()));
|
||||
if (!fileName.isEmpty())
|
||||
arguments << "--" << fileName;
|
||||
VcsOutputWindow::appendCommand(workingDirectory, FileName::fromString(binary), arguments);
|
||||
VcsOutputWindow::appendCommand(workingDirectory, FilePath::fromString(binary), arguments);
|
||||
// This should always use QProcess::startDetached (as not to kill
|
||||
// the child), but that does not have an environment parameter.
|
||||
bool success = false;
|
||||
@@ -2401,7 +2401,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
|
||||
bool GitClient::launchGitGui(const QString &workingDirectory) {
|
||||
bool success = true;
|
||||
FileName gitBinary = vcsBinary();
|
||||
FilePath gitBinary = vcsBinary();
|
||||
if (gitBinary.isEmpty()) {
|
||||
success = false;
|
||||
} else {
|
||||
@@ -2415,11 +2415,11 @@ bool GitClient::launchGitGui(const QString &workingDirectory) {
|
||||
return success;
|
||||
}
|
||||
|
||||
FileName GitClient::gitBinDirectory()
|
||||
FilePath GitClient::gitBinDirectory()
|
||||
{
|
||||
const QString git = vcsBinary().toString();
|
||||
if (git.isEmpty())
|
||||
return FileName();
|
||||
return FilePath();
|
||||
|
||||
// Is 'git\cmd' in the path (folder containing .bats)?
|
||||
QString path = QFileInfo(git).absolutePath();
|
||||
@@ -2439,15 +2439,15 @@ FileName GitClient::gitBinDirectory()
|
||||
path = usrBinPath;
|
||||
}
|
||||
}
|
||||
return FileName::fromString(path);
|
||||
return FilePath::fromString(path);
|
||||
}
|
||||
|
||||
FileName GitClient::vcsBinary() const
|
||||
FilePath GitClient::vcsBinary() const
|
||||
{
|
||||
bool ok;
|
||||
Utils::FileName binary = static_cast<GitSettings &>(settings()).gitExecutable(&ok);
|
||||
Utils::FilePath binary = static_cast<GitSettings &>(settings()).gitExecutable(&ok);
|
||||
if (!ok)
|
||||
return Utils::FileName();
|
||||
return Utils::FilePath();
|
||||
return binary;
|
||||
}
|
||||
|
||||
@@ -2612,7 +2612,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
if (!QFile::exists(templateFilename))
|
||||
templateFilename = gitDirectory.absoluteFilePath("SQUASH_MSG");
|
||||
if (!QFile::exists(templateFilename)) {
|
||||
FileName templateName = FileName::fromUserInput(
|
||||
FilePath templateName = FilePath::fromUserInput(
|
||||
readConfigValue(workingDirectory, "commit.template"));
|
||||
templateFilename = templateName.toString();
|
||||
}
|
||||
@@ -3259,7 +3259,7 @@ QString GitClient::readOneLine(const QString &workingDirectory, const QStringLis
|
||||
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
|
||||
unsigned GitClient::gitVersion(QString *errorMessage) const
|
||||
{
|
||||
const FileName newGitBinary = vcsBinary();
|
||||
const FilePath newGitBinary = vcsBinary();
|
||||
if (m_gitVersionForBinary != newGitBinary && !newGitBinary.isEmpty()) {
|
||||
// Do not execute repeatedly if that fails (due to git
|
||||
// not being installed) until settings are changed.
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
|
||||
explicit GitClient();
|
||||
|
||||
Utils::FileName vcsBinary() const override;
|
||||
Utils::FilePath vcsBinary() const override;
|
||||
unsigned gitVersion(QString *errorMessage = nullptr) const;
|
||||
|
||||
VcsBase::VcsCommand *vcsExecAbortable(const QString &workingDirectory,
|
||||
@@ -306,7 +306,7 @@ public:
|
||||
void launchGitK(const QString &workingDirectory, const QString &fileName);
|
||||
void launchGitK(const QString &workingDirectory) { launchGitK(workingDirectory, QString()); }
|
||||
bool launchGitGui(const QString &workingDirectory);
|
||||
Utils::FileName gitBinDirectory();
|
||||
Utils::FilePath gitBinDirectory();
|
||||
|
||||
void launchRepositoryBrowser(const QString &workingDirectory);
|
||||
|
||||
@@ -369,7 +369,7 @@ private:
|
||||
QString msgBoxText, const QString &buttonName,
|
||||
const QString &gitCommand, ContinueCommandMode continueMode);
|
||||
|
||||
mutable Utils::FileName m_gitVersionForBinary;
|
||||
mutable Utils::FilePath m_gitVersionForBinary;
|
||||
mutable unsigned m_cachedGitVersion;
|
||||
|
||||
QString m_gitQtcEditor;
|
||||
|
||||
@@ -368,7 +368,7 @@ QString GitEditorWidget::fileNameForLine(int line) const
|
||||
|
||||
QString GitEditorWidget::sourceWorkingDirectory() const
|
||||
{
|
||||
Utils::FileName path = Utils::FileName::fromString(source());
|
||||
Utils::FilePath path = Utils::FilePath::fromString(source());
|
||||
if (!path.isEmpty() && !path.toFileInfo().isDir())
|
||||
path = path.parentDir();
|
||||
while (!path.isEmpty() && !path.exists())
|
||||
|
||||
@@ -69,7 +69,7 @@ GitSettings::GitSettings()
|
||||
declareKey(lastResetIndexKey, 0);
|
||||
}
|
||||
|
||||
Utils::FileName GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
|
||||
Utils::FilePath GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
|
||||
{
|
||||
// Locate binary in path if one is specified, otherwise default
|
||||
// to pathless binary
|
||||
@@ -78,7 +78,7 @@ Utils::FileName GitSettings::gitExecutable(bool *ok, QString *errorMessage) cons
|
||||
if (errorMessage)
|
||||
errorMessage->clear();
|
||||
|
||||
Utils::FileName binPath = binaryPath();
|
||||
Utils::FilePath binPath = binaryPath();
|
||||
if (binPath.isEmpty()) {
|
||||
if (ok)
|
||||
*ok = false;
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
static const QLatin1String firstParentKey;
|
||||
static const QLatin1String lastResetIndexKey;
|
||||
|
||||
Utils::FileName gitExecutable(bool *ok = nullptr, QString *errorMessage = nullptr) const;
|
||||
Utils::FilePath gitExecutable(bool *ok = nullptr, QString *errorMessage = nullptr) const;
|
||||
|
||||
GitSettings &operator = (const GitSettings &s);
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ Core::Id GitVersionControl::id() const
|
||||
return Core::Id(VcsBase::Constants::VCS_ID_GIT);
|
||||
}
|
||||
|
||||
bool GitVersionControl::isVcsFileOrDirectory(const Utils::FileName &fileName) const
|
||||
bool GitVersionControl::isVcsFileOrDirectory(const Utils::FilePath &fileName) const
|
||||
{
|
||||
if (fileName.fileName().compare(".git", Utils::HostOsInfo::fileNameCaseSensitivity()))
|
||||
return false;
|
||||
@@ -150,7 +150,7 @@ QString GitVersionControl::vcsTopic(const QString &directory)
|
||||
}
|
||||
|
||||
Core::ShellCommand *GitVersionControl::createInitialCheckoutCommand(const QString &url,
|
||||
const Utils::FileName &baseDirectory,
|
||||
const Utils::FilePath &baseDirectory,
|
||||
const QString &localName,
|
||||
const QStringList &extraArgs)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
QString displayName() const final;
|
||||
Core::Id id() const final;
|
||||
|
||||
bool isVcsFileOrDirectory(const Utils::FileName &fileName) const final;
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
|
||||
bool managesDirectory(const QString &directory, QString *topLevel) const final;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
QString vcsTopic(const QString &directory) final;
|
||||
|
||||
Core::ShellCommand *createInitialCheckoutCommand(const QString &url,
|
||||
const Utils::FileName &baseDirectory,
|
||||
const Utils::FilePath &baseDirectory,
|
||||
const QString &localName,
|
||||
const QStringList &extraArgs) final;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
|
||||
m_process->setWorkingDirectory(workingDirectory);
|
||||
m_process->setProcessEnvironment(env);
|
||||
m_process->setProcessChannelMode(QProcess::MergedChannels);
|
||||
const Utils::FileName binary = GitPlugin::client()->vcsBinary();
|
||||
const Utils::FilePath binary = GitPlugin::client()->vcsBinary();
|
||||
VcsOutputWindow::appendCommand(workingDirectory, binary, arguments);
|
||||
m_process->start(binary.toString(), arguments);
|
||||
if (m_process->waitForStarted()) {
|
||||
|
||||
Reference in New Issue
Block a user