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:
@@ -196,7 +196,7 @@ static bool copyRecursively(const QString &srcFilePath,
|
|||||||
if (srcFileInfo.isDir()) {
|
if (srcFileInfo.isDir()) {
|
||||||
QDir targetDir(tgtFilePath);
|
QDir targetDir(tgtFilePath);
|
||||||
targetDir.cdUp();
|
targetDir.cdUp();
|
||||||
if (!targetDir.mkdir(Utils::FileName::fromString(tgtFilePath).fileName()))
|
if (!targetDir.mkdir(Utils::FilePath::fromString(tgtFilePath).fileName()))
|
||||||
return false;
|
return false;
|
||||||
QDir sourceDir(srcFilePath);
|
QDir sourceDir(srcFilePath);
|
||||||
QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
|
QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
|
||||||
|
@@ -756,17 +756,17 @@ bool Snapshot::isEmpty() const
|
|||||||
return _documents.isEmpty();
|
return _documents.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
Snapshot::const_iterator Snapshot::find(const Utils::FileName &fileName) const
|
Snapshot::const_iterator Snapshot::find(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
return _documents.find(fileName);
|
return _documents.find(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Snapshot::remove(const Utils::FileName &fileName)
|
void Snapshot::remove(const Utils::FilePath &fileName)
|
||||||
{
|
{
|
||||||
_documents.remove(fileName);
|
_documents.remove(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Snapshot::contains(const Utils::FileName &fileName) const
|
bool Snapshot::contains(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
return _documents.contains(fileName);
|
return _documents.contains(fileName);
|
||||||
}
|
}
|
||||||
@@ -774,7 +774,7 @@ bool Snapshot::contains(const Utils::FileName &fileName) const
|
|||||||
void Snapshot::insert(Document::Ptr doc)
|
void Snapshot::insert(Document::Ptr doc)
|
||||||
{
|
{
|
||||||
if (doc) {
|
if (doc) {
|
||||||
_documents.insert(Utils::FileName::fromString(doc->fileName()), doc);
|
_documents.insert(Utils::FilePath::fromString(doc->fileName()), doc);
|
||||||
m_deps.files.clear(); // Will trigger re-build when accessed.
|
m_deps.files.clear(); // Will trigger re-build when accessed.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -794,7 +794,7 @@ static QList<Macro> macrosDefinedUntilLine(const QList<Macro> ¯os, int line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Document::Ptr Snapshot::preprocessedDocument(const QByteArray &source,
|
Document::Ptr Snapshot::preprocessedDocument(const QByteArray &source,
|
||||||
const Utils::FileName &fileName,
|
const Utils::FilePath &fileName,
|
||||||
int withDefinedMacrosFromDocumentUntilLine) const
|
int withDefinedMacrosFromDocumentUntilLine) const
|
||||||
{
|
{
|
||||||
Document::Ptr newDoc = Document::create(fileName.toString());
|
Document::Ptr newDoc = Document::create(fileName.toString());
|
||||||
@@ -858,7 +858,7 @@ QList<Snapshot::IncludeLocation> Snapshot::includeLocationsOfDocument(const QStr
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileNameList Snapshot::filesDependingOn(const Utils::FileName &fileName) const
|
Utils::FilePathList Snapshot::filesDependingOn(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
updateDependencyTable();
|
updateDependencyTable();
|
||||||
return m_deps.filesDependingOn(fileName);
|
return m_deps.filesDependingOn(fileName);
|
||||||
@@ -887,7 +887,7 @@ void Snapshot::allIncludesForDocument_helper(const QString &fileName, QSet<QStri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Document::Ptr Snapshot::document(const Utils::FileName &fileName) const
|
Document::Ptr Snapshot::document(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
return _documents.value(fileName);
|
return _documents.value(fileName);
|
||||||
}
|
}
|
||||||
|
@@ -389,7 +389,7 @@ private:
|
|||||||
|
|
||||||
class CPLUSPLUS_EXPORT Snapshot
|
class CPLUSPLUS_EXPORT Snapshot
|
||||||
{
|
{
|
||||||
typedef QHash<Utils::FileName, Document::Ptr> Base;
|
typedef QHash<Utils::FilePath, Document::Ptr> Base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Snapshot();
|
Snapshot();
|
||||||
@@ -403,36 +403,36 @@ public:
|
|||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
|
||||||
void insert(Document::Ptr doc); // ### remove
|
void insert(Document::Ptr doc); // ### remove
|
||||||
void remove(const Utils::FileName &fileName); // ### remove
|
void remove(const Utils::FilePath &fileName); // ### remove
|
||||||
void remove(const QString &fileName)
|
void remove(const QString &fileName)
|
||||||
{ remove(Utils::FileName::fromString(fileName)); }
|
{ remove(Utils::FilePath::fromString(fileName)); }
|
||||||
|
|
||||||
const_iterator begin() const { return _documents.begin(); }
|
const_iterator begin() const { return _documents.begin(); }
|
||||||
const_iterator end() const { return _documents.end(); }
|
const_iterator end() const { return _documents.end(); }
|
||||||
|
|
||||||
bool contains(const Utils::FileName &fileName) const;
|
bool contains(const Utils::FilePath &fileName) const;
|
||||||
bool contains(const QString &fileName) const
|
bool contains(const QString &fileName) const
|
||||||
{ return contains(Utils::FileName::fromString(fileName)); }
|
{ return contains(Utils::FilePath::fromString(fileName)); }
|
||||||
|
|
||||||
Document::Ptr document(const Utils::FileName &fileName) const;
|
Document::Ptr document(const Utils::FilePath &fileName) const;
|
||||||
Document::Ptr document(const QString &fileName) const
|
Document::Ptr document(const QString &fileName) const
|
||||||
{ return document(Utils::FileName::fromString(fileName)); }
|
{ return document(Utils::FilePath::fromString(fileName)); }
|
||||||
|
|
||||||
const_iterator find(const Utils::FileName &fileName) const;
|
const_iterator find(const Utils::FilePath &fileName) const;
|
||||||
const_iterator find(const QString &fileName) const
|
const_iterator find(const QString &fileName) const
|
||||||
{ return find(Utils::FileName::fromString(fileName)); }
|
{ return find(Utils::FilePath::fromString(fileName)); }
|
||||||
|
|
||||||
Snapshot simplified(Document::Ptr doc) const;
|
Snapshot simplified(Document::Ptr doc) const;
|
||||||
|
|
||||||
Document::Ptr preprocessedDocument(const QByteArray &source,
|
Document::Ptr preprocessedDocument(const QByteArray &source,
|
||||||
const Utils::FileName &fileName,
|
const Utils::FilePath &fileName,
|
||||||
int withDefinedMacrosFromDocumentUntilLine = -1) const;
|
int withDefinedMacrosFromDocumentUntilLine = -1) const;
|
||||||
Document::Ptr preprocessedDocument(const QByteArray &source,
|
Document::Ptr preprocessedDocument(const QByteArray &source,
|
||||||
const QString &fileName,
|
const QString &fileName,
|
||||||
int withDefinedMacrosFromDocumentUntilLine = -1) const
|
int withDefinedMacrosFromDocumentUntilLine = -1) const
|
||||||
{
|
{
|
||||||
return preprocessedDocument(source,
|
return preprocessedDocument(source,
|
||||||
Utils::FileName::fromString(fileName),
|
Utils::FilePath::fromString(fileName),
|
||||||
withDefinedMacrosFromDocumentUntilLine);
|
withDefinedMacrosFromDocumentUntilLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,9 +442,9 @@ public:
|
|||||||
QSet<QString> allIncludesForDocument(const QString &fileName) const;
|
QSet<QString> allIncludesForDocument(const QString &fileName) const;
|
||||||
QList<IncludeLocation> includeLocationsOfDocument(const QString &fileName) const;
|
QList<IncludeLocation> includeLocationsOfDocument(const QString &fileName) const;
|
||||||
|
|
||||||
Utils::FileNameList filesDependingOn(const Utils::FileName &fileName) const;
|
Utils::FilePathList filesDependingOn(const Utils::FilePath &fileName) const;
|
||||||
Utils::FileNameList filesDependingOn(const QString &fileName) const
|
Utils::FilePathList filesDependingOn(const QString &fileName) const
|
||||||
{ return filesDependingOn(Utils::FileName::fromString(fileName)); }
|
{ return filesDependingOn(Utils::FilePath::fromString(fileName)); }
|
||||||
void updateDependencyTable() const;
|
void updateDependencyTable() const;
|
||||||
|
|
||||||
bool operator==(const Snapshot &other) const;
|
bool operator==(const Snapshot &other) const;
|
||||||
|
@@ -29,9 +29,9 @@
|
|||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
Utils::FileNameList DependencyTable::filesDependingOn(const Utils::FileName &fileName) const
|
Utils::FilePathList DependencyTable::filesDependingOn(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
Utils::FileNameList deps;
|
Utils::FilePathList deps;
|
||||||
|
|
||||||
int index = fileIndex.value(fileName, -1);
|
int index = fileIndex.value(fileName, -1);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
@@ -66,14 +66,14 @@ void DependencyTable::build(const Snapshot &snapshot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < files.size(); ++i) {
|
for (int i = 0; i < files.size(); ++i) {
|
||||||
const Utils::FileName &fileName = files.at(i);
|
const Utils::FilePath &fileName = files.at(i);
|
||||||
if (Document::Ptr doc = snapshot.document(fileName)) {
|
if (Document::Ptr doc = snapshot.document(fileName)) {
|
||||||
QBitArray bitmap(files.size());
|
QBitArray bitmap(files.size());
|
||||||
QList<int> directIncludes;
|
QList<int> directIncludes;
|
||||||
const QStringList documentIncludes = doc->includedFiles();
|
const QStringList documentIncludes = doc->includedFiles();
|
||||||
|
|
||||||
foreach (const QString &includedFile, documentIncludes) {
|
foreach (const QString &includedFile, documentIncludes) {
|
||||||
int index = fileIndex.value(Utils::FileName::fromString(includedFile));
|
int index = fileIndex.value(Utils::FilePath::fromString(includedFile));
|
||||||
|
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
continue;
|
continue;
|
||||||
|
@@ -44,10 +44,10 @@ class CPLUSPLUS_EXPORT DependencyTable
|
|||||||
private:
|
private:
|
||||||
friend class Snapshot;
|
friend class Snapshot;
|
||||||
void build(const Snapshot &snapshot);
|
void build(const Snapshot &snapshot);
|
||||||
Utils::FileNameList filesDependingOn(const Utils::FileName &fileName) const;
|
Utils::FilePathList filesDependingOn(const Utils::FilePath &fileName) const;
|
||||||
|
|
||||||
QVector<Utils::FileName> files;
|
QVector<Utils::FilePath> files;
|
||||||
QHash<Utils::FileName, int> fileIndex;
|
QHash<Utils::FilePath, int> fileIndex;
|
||||||
QHash<int, QList<int> > includes;
|
QHash<int, QList<int> > includes;
|
||||||
QVector<QBitArray> includeMap;
|
QVector<QBitArray> includeMap;
|
||||||
};
|
};
|
||||||
|
@@ -170,7 +170,7 @@ void FindUsages::reportResult(unsigned tokenIndex)
|
|||||||
|
|
||||||
const int len = tk.utf16chars();
|
const int len = tk.utf16chars();
|
||||||
|
|
||||||
const Usage u(Utils::FileName::fromString(_doc->fileName()), lineText, line, col, len);
|
const Usage u(Utils::FilePath::fromString(_doc->fileName()), lineText, line, col, len);
|
||||||
_usages.append(u);
|
_usages.append(u);
|
||||||
_references.append(tokenIndex);
|
_references.append(tokenIndex);
|
||||||
}
|
}
|
||||||
|
@@ -40,11 +40,11 @@ class CPLUSPLUS_EXPORT Usage
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Usage() = default;
|
Usage() = default;
|
||||||
Usage(const Utils::FileName &path, const QString &lineText, int line, int col, int len)
|
Usage(const Utils::FilePath &path, const QString &lineText, int line, int col, int len)
|
||||||
: path(path), lineText(lineText), line(line), col(col), len(len) {}
|
: path(path), lineText(lineText), line(line), col(col), len(len) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Utils::FileName path;
|
Utils::FilePath path;
|
||||||
QString lineText;
|
QString lineText;
|
||||||
int line = 0;
|
int line = 0;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
|
@@ -362,7 +362,7 @@ bool Range::overlaps(const Range &range) const
|
|||||||
return contains(range.start()) || contains(range.end());
|
return contains(range.start()) || contains(range.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DocumentFilter::applies(const Utils::FileName &fileName, const Utils::MimeType &mimeType) const
|
bool DocumentFilter::applies(const Utils::FilePath &fileName, const Utils::MimeType &mimeType) const
|
||||||
{
|
{
|
||||||
if (Utils::optional<QString> _scheme = scheme()) {
|
if (Utils::optional<QString> _scheme = scheme()) {
|
||||||
if (_scheme.value() == fileName.toString())
|
if (_scheme.value() == fileName.toString())
|
||||||
@@ -406,14 +406,14 @@ DocumentUri::DocumentUri(const QString &other)
|
|||||||
: QUrl(QUrl::fromPercentEncoding(other.toLocal8Bit()))
|
: QUrl(QUrl::fromPercentEncoding(other.toLocal8Bit()))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
DocumentUri::DocumentUri(const Utils::FileName &other)
|
DocumentUri::DocumentUri(const Utils::FilePath &other)
|
||||||
: QUrl(QUrl::fromLocalFile(other.toString()))
|
: QUrl(QUrl::fromLocalFile(other.toString()))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Utils::FileName DocumentUri::toFileName() const
|
Utils::FilePath DocumentUri::toFileName() const
|
||||||
{
|
{
|
||||||
return isLocalFile() ? Utils::FileName::fromUserInput(QUrl(*this).toLocalFile())
|
return isLocalFile() ? Utils::FilePath::fromUserInput(QUrl(*this).toLocalFile())
|
||||||
: Utils::FileName();
|
: Utils::FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
MarkupKind::MarkupKind(const QJsonValue &value)
|
MarkupKind::MarkupKind(const QJsonValue &value)
|
||||||
|
@@ -45,16 +45,16 @@ class LANGUAGESERVERPROTOCOL_EXPORT DocumentUri : public QUrl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DocumentUri() = default;
|
DocumentUri() = default;
|
||||||
Utils::FileName toFileName() const;
|
Utils::FilePath toFileName() const;
|
||||||
|
|
||||||
static DocumentUri fromProtocol(const QString &uri) { return DocumentUri(uri); }
|
static DocumentUri fromProtocol(const QString &uri) { return DocumentUri(uri); }
|
||||||
static DocumentUri fromFileName(const Utils::FileName &file) { return DocumentUri(file); }
|
static DocumentUri fromFileName(const Utils::FilePath &file) { return DocumentUri(file); }
|
||||||
|
|
||||||
operator QJsonValue() const { return QJsonValue(toString()); }
|
operator QJsonValue() const { return QJsonValue(toString()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DocumentUri(const QString &other);
|
DocumentUri(const QString &other);
|
||||||
DocumentUri(const Utils::FileName &other);
|
DocumentUri(const Utils::FilePath &other);
|
||||||
|
|
||||||
friend class LanguageClientValue<QString>;
|
friend class LanguageClientValue<QString>;
|
||||||
};
|
};
|
||||||
@@ -372,7 +372,7 @@ public:
|
|||||||
void setPattern(const QString &pattern) { insert(patternKey, pattern); }
|
void setPattern(const QString &pattern) { insert(patternKey, pattern); }
|
||||||
void clearPattern() { remove(patternKey); }
|
void clearPattern() { remove(patternKey); }
|
||||||
|
|
||||||
bool applies(const Utils::FileName &fileName,
|
bool applies(const Utils::FilePath &fileName,
|
||||||
const Utils::MimeType &mimeType = Utils::MimeType()) const;
|
const Utils::MimeType &mimeType = Utils::MimeType()) const;
|
||||||
|
|
||||||
bool isValid(QStringList *error) const override;
|
bool isValid(QStringList *error) const override;
|
||||||
|
@@ -161,7 +161,7 @@ bool ServerCapabilities::WorkspaceServerCapabilities::WorkspaceFoldersCapabiliti
|
|||||||
&& checkOptional<QString, bool>(error, changeNotificationsKey);
|
&& checkOptional<QString, bool>(error, changeNotificationsKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextDocumentRegistrationOptions::filterApplies(const Utils::FileName &fileName,
|
bool TextDocumentRegistrationOptions::filterApplies(const Utils::FilePath &fileName,
|
||||||
const Utils::MimeType &mimeType) const
|
const Utils::MimeType &mimeType) const
|
||||||
{
|
{
|
||||||
const LanguageClientArray<DocumentFilter> &selector = documentSelector();
|
const LanguageClientArray<DocumentFilter> &selector = documentSelector();
|
||||||
|
@@ -52,7 +52,7 @@ public:
|
|||||||
void setDocumentSelector(const LanguageClientArray<DocumentFilter> &documentSelector)
|
void setDocumentSelector(const LanguageClientArray<DocumentFilter> &documentSelector)
|
||||||
{ insert(documentSelectorKey, documentSelector.toJson()); }
|
{ insert(documentSelectorKey, documentSelector.toJson()); }
|
||||||
|
|
||||||
bool filterApplies(const Utils::FileName &fileName,
|
bool filterApplies(const Utils::FilePath &fileName,
|
||||||
const Utils::MimeType &mimeType = Utils::MimeType()) const;
|
const Utils::MimeType &mimeType = Utils::MimeType()) const;
|
||||||
|
|
||||||
bool isValid(QStringList *error) const override
|
bool isValid(QStringList *error) const override
|
||||||
@@ -268,7 +268,7 @@ public:
|
|||||||
void setDocumentSelector(const LanguageClientArray<DocumentFilter> &documentSelector)
|
void setDocumentSelector(const LanguageClientArray<DocumentFilter> &documentSelector)
|
||||||
{ insert(documentSelectorKey, documentSelector.toJson()); }
|
{ insert(documentSelectorKey, documentSelector.toJson()); }
|
||||||
|
|
||||||
bool filterApplies(const Utils::FileName &fileName,
|
bool filterApplies(const Utils::FilePath &fileName,
|
||||||
const Utils::MimeType &mimeType = Utils::MimeType()) const;
|
const Utils::MimeType &mimeType = Utils::MimeType()) const;
|
||||||
|
|
||||||
// The id used to register the request. The id can be used to deregister
|
// The id used to register the request. The id can be used to deregister
|
||||||
|
@@ -232,7 +232,7 @@ QDebug operator << (QDebug &dbg, const Dialect &dialect)
|
|||||||
return dbg;
|
return dbg;
|
||||||
}
|
}
|
||||||
|
|
||||||
PathAndLanguage::PathAndLanguage(const Utils::FileName &path, Dialect language)
|
PathAndLanguage::PathAndLanguage(const Utils::FilePath &path, Dialect language)
|
||||||
: m_path(path), m_language(language)
|
: m_path(path), m_language(language)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -293,11 +293,11 @@ void PathsAndLanguages::compact()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int oldCompactionPlace = 0;
|
int oldCompactionPlace = 0;
|
||||||
Utils::FileName oldPath = m_list.first().path();
|
Utils::FilePath oldPath = m_list.first().path();
|
||||||
QList<PathAndLanguage> compactedList;
|
QList<PathAndLanguage> compactedList;
|
||||||
bool restrictFailed = false;
|
bool restrictFailed = false;
|
||||||
for (int i = 1; i < m_list.length(); ++i) {
|
for (int i = 1; i < m_list.length(); ++i) {
|
||||||
Utils::FileName newPath = m_list.at(i).path();
|
Utils::FilePath newPath = m_list.at(i).path();
|
||||||
if (newPath == oldPath) {
|
if (newPath == oldPath) {
|
||||||
int newCompactionPlace = i - 1;
|
int newCompactionPlace = i - 1;
|
||||||
compactedList << m_list.mid(oldCompactionPlace, newCompactionPlace - oldCompactionPlace);
|
compactedList << m_list.mid(oldCompactionPlace, newCompactionPlace - oldCompactionPlace);
|
||||||
|
@@ -78,8 +78,8 @@ QMLJS_EXPORT QDebug operator << (QDebug &dbg, const Dialect &dialect);
|
|||||||
|
|
||||||
class QMLJS_EXPORT PathAndLanguage {
|
class QMLJS_EXPORT PathAndLanguage {
|
||||||
public:
|
public:
|
||||||
PathAndLanguage(const Utils::FileName &path = Utils::FileName(), Dialect language = Dialect::AnyLanguage);
|
PathAndLanguage(const Utils::FilePath &path = Utils::FilePath(), Dialect language = Dialect::AnyLanguage);
|
||||||
Utils::FileName path() const {
|
Utils::FilePath path() const {
|
||||||
return m_path;
|
return m_path;
|
||||||
}
|
}
|
||||||
Dialect language() const {
|
Dialect language() const {
|
||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
bool operator ==(const PathAndLanguage &other) const;
|
bool operator ==(const PathAndLanguage &other) const;
|
||||||
bool operator < (const PathAndLanguage &other) const;
|
bool operator < (const PathAndLanguage &other) const;
|
||||||
private:
|
private:
|
||||||
Utils::FileName m_path;
|
Utils::FilePath m_path;
|
||||||
Dialect m_language;
|
Dialect m_language;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
: m_list(list)
|
: m_list(list)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool maybeInsert(const Utils::FileName &path, Dialect language = Dialect::AnyLanguage) {
|
bool maybeInsert(const Utils::FilePath &path, Dialect language = Dialect::AnyLanguage) {
|
||||||
return maybeInsert(PathAndLanguage(path, language));
|
return maybeInsert(PathAndLanguage(path, language));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1100,14 +1100,14 @@ void ModelManagerInterface::updateImportPaths()
|
|||||||
PathAndLanguage pAndL = iPaths.at(i);
|
PathAndLanguage pAndL = iPaths.at(i);
|
||||||
const QString canonicalPath = pAndL.path().toFileInfo().canonicalFilePath();
|
const QString canonicalPath = pAndL.path().toFileInfo().canonicalFilePath();
|
||||||
if (!canonicalPath.isEmpty())
|
if (!canonicalPath.isEmpty())
|
||||||
allImportPaths.maybeInsert(Utils::FileName::fromString(canonicalPath),
|
allImportPaths.maybeInsert(Utils::FilePath::fromString(canonicalPath),
|
||||||
pAndL.language());
|
pAndL.language());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (vCtxsIter.hasNext()) {
|
while (vCtxsIter.hasNext()) {
|
||||||
vCtxsIter.next();
|
vCtxsIter.next();
|
||||||
foreach (const QString &path, vCtxsIter.value().paths)
|
foreach (const QString &path, vCtxsIter.value().paths)
|
||||||
allImportPaths.maybeInsert(Utils::FileName::fromString(path), vCtxsIter.value().language);
|
allImportPaths.maybeInsert(Utils::FilePath::fromString(path), vCtxsIter.value().language);
|
||||||
}
|
}
|
||||||
pInfoIter.toFront();
|
pInfoIter.toFront();
|
||||||
while (pInfoIter.hasNext()) {
|
while (pInfoIter.hasNext()) {
|
||||||
@@ -1118,7 +1118,7 @@ void ModelManagerInterface::updateImportPaths()
|
|||||||
.searchPaths().stringList()) {
|
.searchPaths().stringList()) {
|
||||||
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
|
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
|
||||||
if (!canonicalPath.isEmpty())
|
if (!canonicalPath.isEmpty())
|
||||||
allImportPaths.maybeInsert(Utils::FileName::fromString(canonicalPath), l);
|
allImportPaths.maybeInsert(Utils::FilePath::fromString(canonicalPath), l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1127,16 +1127,16 @@ void ModelManagerInterface::updateImportPaths()
|
|||||||
pInfoIter.next();
|
pInfoIter.next();
|
||||||
QString pathAtt = pInfoIter.value().qtQmlPath;
|
QString pathAtt = pInfoIter.value().qtQmlPath;
|
||||||
if (!pathAtt.isEmpty())
|
if (!pathAtt.isEmpty())
|
||||||
allImportPaths.maybeInsert(Utils::FileName::fromString(pathAtt), Dialect::QmlQtQuick2);
|
allImportPaths.maybeInsert(Utils::FilePath::fromString(pathAtt), Dialect::QmlQtQuick2);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QString pathAtt = defaultProjectInfo().qtQmlPath;
|
QString pathAtt = defaultProjectInfo().qtQmlPath;
|
||||||
if (!pathAtt.isEmpty())
|
if (!pathAtt.isEmpty())
|
||||||
allImportPaths.maybeInsert(Utils::FileName::fromString(pathAtt), Dialect::QmlQtQuick2);
|
allImportPaths.maybeInsert(Utils::FilePath::fromString(pathAtt), Dialect::QmlQtQuick2);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const QString &path, m_defaultImportPaths)
|
foreach (const QString &path, m_defaultImportPaths)
|
||||||
allImportPaths.maybeInsert(Utils::FileName::fromString(path), Dialect::Qml);
|
allImportPaths.maybeInsert(Utils::FilePath::fromString(path), Dialect::Qml);
|
||||||
allImportPaths.compact();
|
allImportPaths.compact();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@@ -138,7 +138,7 @@ void SftpSession::doStart()
|
|||||||
{
|
{
|
||||||
if (d->state != State::Starting)
|
if (d->state != State::Starting)
|
||||||
return;
|
return;
|
||||||
const FileName sftpBinary = SshSettings::sftpFilePath();
|
const FilePath sftpBinary = SshSettings::sftpFilePath();
|
||||||
if (!sftpBinary.exists()) {
|
if (!sftpBinary.exists()) {
|
||||||
d->state = State::Inactive;
|
d->state = State::Inactive;
|
||||||
emit done(tr("Cannot establish SFTP session: sftp binary \"%1\" does not exist.")
|
emit done(tr("Cannot establish SFTP session: sftp binary \"%1\" does not exist.")
|
||||||
|
@@ -132,7 +132,7 @@ SftpTransfer::SftpTransfer(const FilesToTransfer &files, Internal::FileTransferT
|
|||||||
|
|
||||||
void SftpTransfer::doStart()
|
void SftpTransfer::doStart()
|
||||||
{
|
{
|
||||||
const FileName sftpBinary = SshSettings::sftpFilePath();
|
const FilePath sftpBinary = SshSettings::sftpFilePath();
|
||||||
if (!sftpBinary.exists()) {
|
if (!sftpBinary.exists()) {
|
||||||
emitError(tr("sftp binary \"%1\" does not exist.").arg(sftpBinary.toUserOutput()));
|
emitError(tr("sftp binary \"%1\" does not exist.").arg(sftpBinary.toUserOutput()));
|
||||||
return;
|
return;
|
||||||
|
@@ -342,7 +342,7 @@ void SshConnection::doConnectToHost()
|
|||||||
{
|
{
|
||||||
if (d->state != Connecting)
|
if (d->state != Connecting)
|
||||||
return;
|
return;
|
||||||
const FileName sshBinary = SshSettings::sshFilePath();
|
const FilePath sshBinary = SshSettings::sshFilePath();
|
||||||
if (!sshBinary.exists()) {
|
if (!sshBinary.exists()) {
|
||||||
emitError(tr("Cannot establish SSH connection: ssh binary \"%1\" does not exist.")
|
emitError(tr("Cannot establish SSH connection: ssh binary \"%1\" does not exist.")
|
||||||
.arg(sshBinary.toUserOutput()));
|
.arg(sshBinary.toUserOutput()));
|
||||||
|
@@ -39,11 +39,11 @@ struct SshSettings
|
|||||||
{
|
{
|
||||||
bool useConnectionSharing = !HostOsInfo::isWindowsHost();
|
bool useConnectionSharing = !HostOsInfo::isWindowsHost();
|
||||||
int connectionSharingTimeOutInMinutes = 10;
|
int connectionSharingTimeOutInMinutes = 10;
|
||||||
FileName sshFilePath;
|
FilePath sshFilePath;
|
||||||
FileName sftpFilePath;
|
FilePath sftpFilePath;
|
||||||
FileName askpassFilePath;
|
FilePath askpassFilePath;
|
||||||
FileName keygenFilePath;
|
FilePath keygenFilePath;
|
||||||
QSsh::SshSettings::SearchPathRetriever searchPathRetriever = [] { return FileNameList(); };
|
QSsh::SshSettings::SearchPathRetriever searchPathRetriever = [] { return FilePathList(); };
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
@@ -79,11 +79,11 @@ void SshSettings::loadSettings(QSettings *settings)
|
|||||||
value = settings->value(connectionSharingTimeoutKey());
|
value = settings->value(connectionSharingTimeoutKey());
|
||||||
if (value.isValid())
|
if (value.isValid())
|
||||||
sshSettings->connectionSharingTimeOutInMinutes = value.toInt();
|
sshSettings->connectionSharingTimeOutInMinutes = value.toInt();
|
||||||
sshSettings->sshFilePath = FileName::fromString(settings->value(sshFilePathKey()).toString());
|
sshSettings->sshFilePath = FilePath::fromString(settings->value(sshFilePathKey()).toString());
|
||||||
sshSettings->sftpFilePath = FileName::fromString(settings->value(sftpFilePathKey()).toString());
|
sshSettings->sftpFilePath = FilePath::fromString(settings->value(sftpFilePathKey()).toString());
|
||||||
sshSettings->askpassFilePath = FileName::fromString(
|
sshSettings->askpassFilePath = FilePath::fromString(
|
||||||
settings->value(askPassFilePathKey()).toString());
|
settings->value(askPassFilePathKey()).toString());
|
||||||
sshSettings->keygenFilePath = FileName::fromString(
|
sshSettings->keygenFilePath = FilePath::fromString(
|
||||||
settings->value(keygenFilePathKey()).toString());
|
settings->value(keygenFilePathKey()).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,51 +114,51 @@ int SshSettings::connectionSharingTimeout()
|
|||||||
return sshSettings->connectionSharingTimeOutInMinutes;
|
return sshSettings->connectionSharingTimeOutInMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FileName filePathValue(const FileName &value, const QStringList &candidateFileNames)
|
static FilePath filePathValue(const FilePath &value, const QStringList &candidateFileNames)
|
||||||
{
|
{
|
||||||
if (!value.isEmpty())
|
if (!value.isEmpty())
|
||||||
return value;
|
return value;
|
||||||
const QList<FileName> additionalSearchPaths = sshSettings->searchPathRetriever();
|
const QList<FilePath> additionalSearchPaths = sshSettings->searchPathRetriever();
|
||||||
for (const QString &candidate : candidateFileNames) {
|
for (const QString &candidate : candidateFileNames) {
|
||||||
const FileName filePath = Environment::systemEnvironment()
|
const FilePath filePath = Environment::systemEnvironment()
|
||||||
.searchInPath(candidate, additionalSearchPaths);
|
.searchInPath(candidate, additionalSearchPaths);
|
||||||
if (!filePath.isEmpty())
|
if (!filePath.isEmpty())
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
return FileName();
|
return FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
static FileName filePathValue(const FileName &value, const QString &candidateFileName)
|
static FilePath filePathValue(const FilePath &value, const QString &candidateFileName)
|
||||||
{
|
{
|
||||||
return filePathValue(value, QStringList(candidateFileName));
|
return filePathValue(value, QStringList(candidateFileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshSettings::setSshFilePath(const FileName &ssh) { sshSettings->sshFilePath = ssh; }
|
void SshSettings::setSshFilePath(const FilePath &ssh) { sshSettings->sshFilePath = ssh; }
|
||||||
FileName SshSettings::sshFilePath() { return filePathValue(sshSettings->sshFilePath, "ssh"); }
|
FilePath SshSettings::sshFilePath() { return filePathValue(sshSettings->sshFilePath, "ssh"); }
|
||||||
|
|
||||||
void SshSettings::setSftpFilePath(const FileName &sftp) { sshSettings->sftpFilePath = sftp; }
|
void SshSettings::setSftpFilePath(const FilePath &sftp) { sshSettings->sftpFilePath = sftp; }
|
||||||
FileName SshSettings::sftpFilePath() { return filePathValue(sshSettings->sftpFilePath, "sftp"); }
|
FilePath SshSettings::sftpFilePath() { return filePathValue(sshSettings->sftpFilePath, "sftp"); }
|
||||||
|
|
||||||
void SshSettings::setAskpassFilePath(const FileName &askPass)
|
void SshSettings::setAskpassFilePath(const FilePath &askPass)
|
||||||
{
|
{
|
||||||
sshSettings->askpassFilePath = askPass;
|
sshSettings->askpassFilePath = askPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName SshSettings::askpassFilePath()
|
FilePath SshSettings::askpassFilePath()
|
||||||
{
|
{
|
||||||
FileName candidate;
|
FilePath candidate;
|
||||||
candidate = sshSettings->askpassFilePath;
|
candidate = sshSettings->askpassFilePath;
|
||||||
if (candidate.isEmpty())
|
if (candidate.isEmpty())
|
||||||
candidate = FileName::fromString(Environment::systemEnvironment().value("SSH_ASKPASS"));
|
candidate = FilePath::fromString(Environment::systemEnvironment().value("SSH_ASKPASS"));
|
||||||
return filePathValue(candidate, QStringList{"qtc-askpass", "ssh-askpass"});
|
return filePathValue(candidate, QStringList{"qtc-askpass", "ssh-askpass"});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshSettings::setKeygenFilePath(const FileName &keygen)
|
void SshSettings::setKeygenFilePath(const FilePath &keygen)
|
||||||
{
|
{
|
||||||
sshSettings->keygenFilePath = keygen;
|
sshSettings->keygenFilePath = keygen;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName SshSettings::keygenFilePath()
|
FilePath SshSettings::keygenFilePath()
|
||||||
{
|
{
|
||||||
return filePathValue(sshSettings->keygenFilePath, "ssh-keygen");
|
return filePathValue(sshSettings->keygenFilePath, "ssh-keygen");
|
||||||
}
|
}
|
||||||
|
@@ -49,19 +49,19 @@ public:
|
|||||||
static void setConnectionSharingTimeout(int timeInMinutes);
|
static void setConnectionSharingTimeout(int timeInMinutes);
|
||||||
static int connectionSharingTimeout();
|
static int connectionSharingTimeout();
|
||||||
|
|
||||||
static void setSshFilePath(const Utils::FileName &ssh);
|
static void setSshFilePath(const Utils::FilePath &ssh);
|
||||||
static Utils::FileName sshFilePath();
|
static Utils::FilePath sshFilePath();
|
||||||
|
|
||||||
static void setSftpFilePath(const Utils::FileName &sftp);
|
static void setSftpFilePath(const Utils::FilePath &sftp);
|
||||||
static Utils::FileName sftpFilePath();
|
static Utils::FilePath sftpFilePath();
|
||||||
|
|
||||||
static void setAskpassFilePath(const Utils::FileName &askPass);
|
static void setAskpassFilePath(const Utils::FilePath &askPass);
|
||||||
static Utils::FileName askpassFilePath();
|
static Utils::FilePath askpassFilePath();
|
||||||
|
|
||||||
static void setKeygenFilePath(const Utils::FileName &keygen);
|
static void setKeygenFilePath(const Utils::FilePath &keygen);
|
||||||
static Utils::FileName keygenFilePath();
|
static Utils::FilePath keygenFilePath();
|
||||||
|
|
||||||
using SearchPathRetriever = std::function<Utils::FileNameList()>;
|
using SearchPathRetriever = std::function<Utils::FilePathList()>;
|
||||||
static void setExtraSearchPathRetriever(const SearchPathRetriever &pathRetriever);
|
static void setExtraSearchPathRetriever(const SearchPathRetriever &pathRetriever);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -73,17 +73,17 @@ static bool isQmake(const QString &path)
|
|||||||
return !BuildableHelperLibrary::qtVersionForQMake(fi.absoluteFilePath()).isEmpty();
|
return !BuildableHelperLibrary::qtVersionForQMake(fi.absoluteFilePath()).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
static FileName findQmakeInDir(const FileName &path)
|
static FilePath findQmakeInDir(const FilePath &path)
|
||||||
{
|
{
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return FileName();
|
return FilePath();
|
||||||
|
|
||||||
const QString qmake = "qmake";
|
const QString qmake = "qmake";
|
||||||
QDir dir(path.toString());
|
QDir dir(path.toString());
|
||||||
if (dir.exists(qmake)) {
|
if (dir.exists(qmake)) {
|
||||||
const QString qmakePath = dir.absoluteFilePath(qmake);
|
const QString qmakePath = dir.absoluteFilePath(qmake);
|
||||||
if (isQmake(qmakePath))
|
if (isQmake(qmakePath))
|
||||||
return FileName::fromString(qmakePath);
|
return FilePath::fromString(qmakePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prefer qmake-qt5 to qmake-qt4 by sorting the filenames in reverse order.
|
// Prefer qmake-qt5 to qmake-qt4 by sorting the filenames in reverse order.
|
||||||
@@ -94,26 +94,26 @@ static FileName findQmakeInDir(const FileName &path)
|
|||||||
if (fi.fileName() == qmake)
|
if (fi.fileName() == qmake)
|
||||||
continue;
|
continue;
|
||||||
if (isQmake(fi.absoluteFilePath()))
|
if (isQmake(fi.absoluteFilePath()))
|
||||||
return FileName::fromFileInfo(fi);
|
return FilePath::fromFileInfo(fi);
|
||||||
}
|
}
|
||||||
return FileName();
|
return FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName BuildableHelperLibrary::findSystemQt(const Environment &env)
|
FilePath BuildableHelperLibrary::findSystemQt(const Environment &env)
|
||||||
{
|
{
|
||||||
const FileNameList list = findQtsInEnvironment(env, 1);
|
const FilePathList list = findQtsInEnvironment(env, 1);
|
||||||
return list.size() == 1 ? list.first() : FileName();
|
return list.size() == 1 ? list.first() : FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileNameList BuildableHelperLibrary::findQtsInEnvironment(const Environment &env, int maxCount)
|
FilePathList BuildableHelperLibrary::findQtsInEnvironment(const Environment &env, int maxCount)
|
||||||
{
|
{
|
||||||
FileNameList qmakeList;
|
FilePathList qmakeList;
|
||||||
std::set<QString> canonicalEnvPaths;
|
std::set<QString> canonicalEnvPaths;
|
||||||
const FileNameList paths = env.path();
|
const FilePathList paths = env.path();
|
||||||
for (const FileName &path : paths) {
|
for (const FilePath &path : paths) {
|
||||||
if (!canonicalEnvPaths.insert(path.toFileInfo().canonicalFilePath()).second)
|
if (!canonicalEnvPaths.insert(path.toFileInfo().canonicalFilePath()).second)
|
||||||
continue;
|
continue;
|
||||||
const FileName qmake = findQmakeInDir(path);
|
const FilePath qmake = findQmakeInDir(path);
|
||||||
if (qmake.isEmpty())
|
if (qmake.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
qmakeList << qmake;
|
qmakeList << qmake;
|
||||||
@@ -189,7 +189,7 @@ bool BuildableHelperLibrary::copyFiles(const QString &sourcePath,
|
|||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
// try remove the directory
|
// try remove the directory
|
||||||
if (!FileUtils::removeRecursively(FileName::fromString(targetDirectory), errorMessage))
|
if (!FileUtils::removeRecursively(FilePath::fromString(targetDirectory), errorMessage))
|
||||||
return false;
|
return false;
|
||||||
if (!QDir().mkpath(targetDirectory)) {
|
if (!QDir().mkpath(targetDirectory)) {
|
||||||
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", "The target directory %1 could not be created.").arg(targetDirectory);
|
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", "The target directory %1 could not be created.").arg(targetDirectory);
|
||||||
@@ -220,7 +220,7 @@ bool BuildableHelperLibrary::copyFiles(const QString &sourcePath,
|
|||||||
|
|
||||||
// Helper: Run a build process with merged stdout/stderr
|
// Helper: Run a build process with merged stdout/stderr
|
||||||
static inline bool runBuildProcessI(QProcess &proc,
|
static inline bool runBuildProcessI(QProcess &proc,
|
||||||
const FileName &binary,
|
const FilePath &binary,
|
||||||
const QStringList &args,
|
const QStringList &args,
|
||||||
int timeoutS,
|
int timeoutS,
|
||||||
bool ignoreNonNullExitCode,
|
bool ignoreNonNullExitCode,
|
||||||
@@ -261,7 +261,7 @@ static inline bool runBuildProcessI(QProcess &proc,
|
|||||||
|
|
||||||
// Run a build process with merged stdout/stderr and qWarn about errors.
|
// Run a build process with merged stdout/stderr and qWarn about errors.
|
||||||
static bool runBuildProcess(QProcess &proc,
|
static bool runBuildProcess(QProcess &proc,
|
||||||
const FileName &binary,
|
const FilePath &binary,
|
||||||
const QStringList &args,
|
const QStringList &args,
|
||||||
int timeoutS,
|
int timeoutS,
|
||||||
bool ignoreNonNullExitCode,
|
bool ignoreNonNullExitCode,
|
||||||
@@ -300,7 +300,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
|
|||||||
arguments.directory));
|
arguments.directory));
|
||||||
log->append(newline);
|
log->append(newline);
|
||||||
|
|
||||||
const FileName makeFullPath = arguments.environment.searchInPath(arguments.makeCommand);
|
const FilePath makeFullPath = arguments.environment.searchInPath(arguments.makeCommand);
|
||||||
if (QFileInfo::exists(arguments.directory + QLatin1String("/Makefile"))) {
|
if (QFileInfo::exists(arguments.directory + QLatin1String("/Makefile"))) {
|
||||||
if (makeFullPath.isEmpty()) {
|
if (makeFullPath.isEmpty()) {
|
||||||
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
|
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
|
||||||
|
@@ -37,8 +37,8 @@ class QTCREATOR_UTILS_EXPORT BuildableHelperLibrary
|
|||||||
public:
|
public:
|
||||||
// returns the full path to the first qmake, qmake-qt4, qmake4 that has
|
// returns the full path to the first qmake, qmake-qt4, qmake4 that has
|
||||||
// at least version 2.0.0 and thus is a qt4 qmake
|
// at least version 2.0.0 and thus is a qt4 qmake
|
||||||
static FileName findSystemQt(const Environment &env);
|
static FilePath findSystemQt(const Environment &env);
|
||||||
static FileNameList findQtsInEnvironment(const Environment &env, int maxCount = -1);
|
static FilePathList findQtsInEnvironment(const Environment &env, int maxCount = -1);
|
||||||
static bool isQtChooser(const QFileInfo &info);
|
static bool isQtChooser(const QFileInfo &info);
|
||||||
static QString qtChooserToQmakePath(const QString &path);
|
static QString qtChooserToQmakePath(const QString &path);
|
||||||
// return true if the qmake at qmakePath is a Qt (used by QtVersion)
|
// return true if the qmake at qmakePath is a Qt (used by QtVersion)
|
||||||
@@ -61,9 +61,9 @@ public:
|
|||||||
QString directory;
|
QString directory;
|
||||||
Environment environment;
|
Environment environment;
|
||||||
|
|
||||||
FileName qmakeCommand;
|
FilePath qmakeCommand;
|
||||||
QString targetMode;
|
QString targetMode;
|
||||||
FileName mkspec;
|
FilePath mkspec;
|
||||||
QString proFilename;
|
QString proFilename;
|
||||||
QStringList qmakeArguments;
|
QStringList qmakeArguments;
|
||||||
|
|
||||||
|
@@ -392,14 +392,14 @@ void Environment::clear()
|
|||||||
m_values.clear();
|
m_values.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName Environment::searchInDirectory(const QStringList &execs, const FileName &directory,
|
FilePath Environment::searchInDirectory(const QStringList &execs, const FilePath &directory,
|
||||||
QSet<FileName> &alreadyChecked) const
|
QSet<FilePath> &alreadyChecked) const
|
||||||
{
|
{
|
||||||
const int checkedCount = alreadyChecked.count();
|
const int checkedCount = alreadyChecked.count();
|
||||||
alreadyChecked.insert(directory);
|
alreadyChecked.insert(directory);
|
||||||
|
|
||||||
if (directory.isEmpty() || alreadyChecked.count() == checkedCount)
|
if (directory.isEmpty() || alreadyChecked.count() == checkedCount)
|
||||||
return FileName();
|
return FilePath();
|
||||||
|
|
||||||
const QString dir = directory.toString();
|
const QString dir = directory.toString();
|
||||||
|
|
||||||
@@ -407,9 +407,9 @@ FileName Environment::searchInDirectory(const QStringList &execs, const FileName
|
|||||||
for (const QString &exec : execs) {
|
for (const QString &exec : execs) {
|
||||||
fi.setFile(dir, exec);
|
fi.setFile(dir, exec);
|
||||||
if (fi.isFile() && fi.isExecutable())
|
if (fi.isFile() && fi.isExecutable())
|
||||||
return FileName::fromString(fi.absoluteFilePath());
|
return FilePath::fromString(fi.absoluteFilePath());
|
||||||
}
|
}
|
||||||
return FileName();
|
return FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Environment::appendExeExtensions(const QString &executable) const
|
QStringList Environment::appendExeExtensions(const QString &executable) const
|
||||||
@@ -435,8 +435,8 @@ bool Environment::isSameExecutable(const QString &exe1, const QString &exe2) con
|
|||||||
const QStringList exe2List = appendExeExtensions(exe2);
|
const QStringList exe2List = appendExeExtensions(exe2);
|
||||||
for (const QString &i1 : exe1List) {
|
for (const QString &i1 : exe1List) {
|
||||||
for (const QString &i2 : exe2List) {
|
for (const QString &i2 : exe2List) {
|
||||||
const FileName f1 = FileName::fromString(i1);
|
const FilePath f1 = FilePath::fromString(i1);
|
||||||
const FileName f2 = FileName::fromString(i2);
|
const FilePath f2 = FilePath::fromString(i2);
|
||||||
if (f1 == f2)
|
if (f1 == f2)
|
||||||
return true;
|
return true;
|
||||||
if (FileUtils::resolveSymlinks(f1) == FileUtils::resolveSymlinks(f2))
|
if (FileUtils::resolveSymlinks(f1) == FileUtils::resolveSymlinks(f2))
|
||||||
@@ -448,12 +448,12 @@ bool Environment::isSameExecutable(const QString &exe1, const QString &exe2) con
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName Environment::searchInPath(const QString &executable,
|
FilePath Environment::searchInPath(const QString &executable,
|
||||||
const FileNameList &additionalDirs,
|
const FilePathList &additionalDirs,
|
||||||
const PathFilter &func) const
|
const PathFilter &func) const
|
||||||
{
|
{
|
||||||
if (executable.isEmpty())
|
if (executable.isEmpty())
|
||||||
return FileName();
|
return FilePath();
|
||||||
|
|
||||||
const QString exec = QDir::cleanPath(expandVariables(executable));
|
const QString exec = QDir::cleanPath(expandVariables(executable));
|
||||||
const QFileInfo fi(exec);
|
const QFileInfo fi(exec);
|
||||||
@@ -464,34 +464,34 @@ FileName Environment::searchInPath(const QString &executable,
|
|||||||
for (const QString &path : execs) {
|
for (const QString &path : execs) {
|
||||||
QFileInfo pfi = QFileInfo(path);
|
QFileInfo pfi = QFileInfo(path);
|
||||||
if (pfi.isFile() && pfi.isExecutable())
|
if (pfi.isFile() && pfi.isExecutable())
|
||||||
return FileName::fromString(path);
|
return FilePath::fromString(path);
|
||||||
}
|
}
|
||||||
return FileName::fromString(exec);
|
return FilePath::fromString(exec);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<FileName> alreadyChecked;
|
QSet<FilePath> alreadyChecked;
|
||||||
for (const FileName &dir : additionalDirs) {
|
for (const FilePath &dir : additionalDirs) {
|
||||||
FileName tmp = searchInDirectory(execs, dir, alreadyChecked);
|
FilePath tmp = searchInDirectory(execs, dir, alreadyChecked);
|
||||||
if (!tmp.isEmpty() && (!func || func(tmp)))
|
if (!tmp.isEmpty() && (!func || func(tmp)))
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (executable.contains('/'))
|
if (executable.contains('/'))
|
||||||
return FileName();
|
return FilePath();
|
||||||
|
|
||||||
for (const FileName &p : path()) {
|
for (const FilePath &p : path()) {
|
||||||
FileName tmp = searchInDirectory(execs, p, alreadyChecked);
|
FilePath tmp = searchInDirectory(execs, p, alreadyChecked);
|
||||||
if (!tmp.isEmpty() && (!func || func(tmp)))
|
if (!tmp.isEmpty() && (!func || func(tmp)))
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
return FileName();
|
return FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileNameList Environment::path() const
|
FilePathList Environment::path() const
|
||||||
{
|
{
|
||||||
const QStringList pathComponents = value("PATH")
|
const QStringList pathComponents = value("PATH")
|
||||||
.split(OsSpecificAspects::pathListSeparator(m_osType), QString::SkipEmptyParts);
|
.split(OsSpecificAspects::pathListSeparator(m_osType), QString::SkipEmptyParts);
|
||||||
return Utils::transform(pathComponents, &FileName::fromUserInput);
|
return Utils::transform(pathComponents, &FilePath::fromUserInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Environment::value(const QString &key) const
|
QString Environment::value(const QString &key) const
|
||||||
@@ -690,9 +690,9 @@ QString Environment::expandVariables(const QString &input) const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName Environment::expandVariables(const FileName &variables) const
|
FilePath Environment::expandVariables(const FilePath &variables) const
|
||||||
{
|
{
|
||||||
return FileName::fromString(expandVariables(variables.toString()));
|
return FilePath::fromString(expandVariables(variables.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Environment::expandVariables(const QStringList &variables) const
|
QStringList Environment::expandVariables(const QStringList &variables) const
|
||||||
|
@@ -124,18 +124,18 @@ public:
|
|||||||
Environment::const_iterator constEnd() const;
|
Environment::const_iterator constEnd() const;
|
||||||
Environment::const_iterator constFind(const QString &name) const;
|
Environment::const_iterator constFind(const QString &name) const;
|
||||||
|
|
||||||
using PathFilter = std::function<bool(const FileName &)>;
|
using PathFilter = std::function<bool(const FilePath &)>;
|
||||||
FileName searchInPath(const QString &executable,
|
FilePath searchInPath(const QString &executable,
|
||||||
const FileNameList &additionalDirs = FileNameList(),
|
const FilePathList &additionalDirs = FilePathList(),
|
||||||
const PathFilter &func = PathFilter()) const;
|
const PathFilter &func = PathFilter()) const;
|
||||||
|
|
||||||
FileNameList path() const;
|
FilePathList path() const;
|
||||||
QStringList appendExeExtensions(const QString &executable) const;
|
QStringList appendExeExtensions(const QString &executable) const;
|
||||||
|
|
||||||
bool isSameExecutable(const QString &exe1, const QString &exe2) const;
|
bool isSameExecutable(const QString &exe1, const QString &exe2) const;
|
||||||
|
|
||||||
QString expandVariables(const QString &input) const;
|
QString expandVariables(const QString &input) const;
|
||||||
FileName expandVariables(const FileName &input) const;
|
FilePath expandVariables(const FilePath &input) const;
|
||||||
QStringList expandVariables(const QStringList &input) const;
|
QStringList expandVariables(const QStringList &input) const;
|
||||||
|
|
||||||
bool operator!=(const Environment &other) const;
|
bool operator!=(const Environment &other) const;
|
||||||
@@ -144,8 +144,8 @@ public:
|
|||||||
static void modifySystemEnvironment(const QList<EnvironmentItem> &list); // use with care!!!
|
static void modifySystemEnvironment(const QList<EnvironmentItem> &list); // use with care!!!
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FileName searchInDirectory(const QStringList &execs, const FileName &directory,
|
FilePath searchInDirectory(const QStringList &execs, const FilePath &directory,
|
||||||
QSet<FileName> &alreadyChecked) const;
|
QSet<FilePath> &alreadyChecked) const;
|
||||||
QMap<QString, QString> m_values;
|
QMap<QString, QString> m_values;
|
||||||
OsType m_osType;
|
OsType m_osType;
|
||||||
};
|
};
|
||||||
|
@@ -38,22 +38,22 @@ FileCrumbLabel::FileCrumbLabel(QWidget *parent)
|
|||||||
setTextFormat(Qt::RichText);
|
setTextFormat(Qt::RichText);
|
||||||
setWordWrap(true);
|
setWordWrap(true);
|
||||||
connect(this, &QLabel::linkActivated, this, [this](const QString &url) {
|
connect(this, &QLabel::linkActivated, this, [this](const QString &url) {
|
||||||
emit pathClicked(FileName::fromString(QUrl(url).toLocalFile()));
|
emit pathClicked(FilePath::fromString(QUrl(url).toLocalFile()));
|
||||||
});
|
});
|
||||||
setPath(FileName());
|
setPath(FilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString linkForPath(const FileName &path, const QString &display)
|
static QString linkForPath(const FilePath &path, const QString &display)
|
||||||
{
|
{
|
||||||
return "<a href=\""
|
return "<a href=\""
|
||||||
+ QUrl::fromLocalFile(path.toString()).toString(QUrl::FullyEncoded) + "\">"
|
+ QUrl::fromLocalFile(path.toString()).toString(QUrl::FullyEncoded) + "\">"
|
||||||
+ display + "</a>";
|
+ display + "</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileCrumbLabel::setPath(const FileName &path)
|
void FileCrumbLabel::setPath(const FilePath &path)
|
||||||
{
|
{
|
||||||
QStringList links;
|
QStringList links;
|
||||||
FileName current = path;
|
FilePath current = path;
|
||||||
while (!current.isEmpty()) {
|
while (!current.isEmpty()) {
|
||||||
const QString fileName = current.fileName();
|
const QString fileName = current.fileName();
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
|
@@ -38,10 +38,10 @@ class QTCREATOR_UTILS_EXPORT FileCrumbLabel : public QLabel
|
|||||||
public:
|
public:
|
||||||
FileCrumbLabel(QWidget *parent = nullptr);
|
FileCrumbLabel(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void setPath(const FileName &path);
|
void setPath(const FilePath &path);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void pathClicked(const FileName &path);
|
void pathClicked(const FilePath &path);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Utils
|
} // Utils
|
||||||
|
@@ -82,7 +82,7 @@ static bool checkPath(const QString &candidate, int matchLength,
|
|||||||
FileInProjectFinder::FileInProjectFinder() = default;
|
FileInProjectFinder::FileInProjectFinder() = default;
|
||||||
FileInProjectFinder::~FileInProjectFinder() = default;
|
FileInProjectFinder::~FileInProjectFinder() = default;
|
||||||
|
|
||||||
void FileInProjectFinder::setProjectDirectory(const FileName &absoluteProjectPath)
|
void FileInProjectFinder::setProjectDirectory(const FilePath &absoluteProjectPath)
|
||||||
{
|
{
|
||||||
if (absoluteProjectPath == m_projectDir)
|
if (absoluteProjectPath == m_projectDir)
|
||||||
return;
|
return;
|
||||||
@@ -95,12 +95,12 @@ void FileInProjectFinder::setProjectDirectory(const FileName &absoluteProjectPat
|
|||||||
m_cache.clear();
|
m_cache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName FileInProjectFinder::projectDirectory() const
|
FilePath FileInProjectFinder::projectDirectory() const
|
||||||
{
|
{
|
||||||
return m_projectDir;
|
return m_projectDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileInProjectFinder::setProjectFiles(const FileNameList &projectFiles)
|
void FileInProjectFinder::setProjectFiles(const FilePathList &projectFiles)
|
||||||
{
|
{
|
||||||
if (m_projectFiles == projectFiles)
|
if (m_projectFiles == projectFiles)
|
||||||
return;
|
return;
|
||||||
@@ -110,7 +110,7 @@ void FileInProjectFinder::setProjectFiles(const FileNameList &projectFiles)
|
|||||||
m_qrcUrlFinder.setProjectFiles(projectFiles);
|
m_qrcUrlFinder.setProjectFiles(projectFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileInProjectFinder::setSysroot(const FileName &sysroot)
|
void FileInProjectFinder::setSysroot(const FilePath &sysroot)
|
||||||
{
|
{
|
||||||
if (m_sysroot == sysroot)
|
if (m_sysroot == sysroot)
|
||||||
return;
|
return;
|
||||||
@@ -119,7 +119,7 @@ void FileInProjectFinder::setSysroot(const FileName &sysroot)
|
|||||||
m_cache.clear();
|
m_cache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileInProjectFinder::addMappedPath(const FileName &localFilePath, const QString &remoteFilePath)
|
void FileInProjectFinder::addMappedPath(const FilePath &localFilePath, const QString &remoteFilePath)
|
||||||
{
|
{
|
||||||
const QStringList segments = remoteFilePath.split('/', QString::SkipEmptyParts);
|
const QStringList segments = remoteFilePath.split('/', QString::SkipEmptyParts);
|
||||||
|
|
||||||
@@ -142,12 +142,12 @@ void FileInProjectFinder::addMappedPath(const FileName &localFilePath, const QSt
|
|||||||
folder specified. Third, we walk the list of project files, and search for a file name match
|
folder specified. Third, we walk the list of project files, and search for a file name match
|
||||||
there. If all fails, it returns the original path from the file URL.
|
there. If all fails, it returns the original path from the file URL.
|
||||||
*/
|
*/
|
||||||
FileNameList FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) const
|
FilePathList FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) const
|
||||||
{
|
{
|
||||||
qCDebug(finderLog) << "FileInProjectFinder: trying to find file" << fileUrl.toString() << "...";
|
qCDebug(finderLog) << "FileInProjectFinder: trying to find file" << fileUrl.toString() << "...";
|
||||||
|
|
||||||
if (fileUrl.scheme() == "qrc" || fileUrl.toString().startsWith(':')) {
|
if (fileUrl.scheme() == "qrc" || fileUrl.toString().startsWith(':')) {
|
||||||
const FileNameList result = m_qrcUrlFinder.find(fileUrl);
|
const FilePathList result = m_qrcUrlFinder.find(fileUrl);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
if (success)
|
if (success)
|
||||||
*success = true;
|
*success = true;
|
||||||
@@ -159,12 +159,12 @@ FileNameList FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) c
|
|||||||
if (originalPath.isEmpty()) // e.g. qrc://
|
if (originalPath.isEmpty()) // e.g. qrc://
|
||||||
originalPath = fileUrl.path();
|
originalPath = fileUrl.path();
|
||||||
|
|
||||||
FileNameList result;
|
FilePathList result;
|
||||||
bool found = findFileOrDirectory(originalPath, [&](const QString &fileName, int) {
|
bool found = findFileOrDirectory(originalPath, [&](const QString &fileName, int) {
|
||||||
result << FileName::fromString(fileName);
|
result << FilePath::fromString(fileName);
|
||||||
});
|
});
|
||||||
if (!found)
|
if (!found)
|
||||||
result << FileName::fromString(originalPath);
|
result << FilePath::fromString(originalPath);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
*success = found;
|
*success = found;
|
||||||
@@ -291,7 +291,7 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
qCDebug(finderLog) << "FileInProjectFinder: checking project files ...";
|
qCDebug(finderLog) << "FileInProjectFinder: checking project files ...";
|
||||||
|
|
||||||
QStringList matches;
|
QStringList matches;
|
||||||
const QString lastSegment = FileName::fromString(originalPath).fileName();
|
const QString lastSegment = FilePath::fromString(originalPath).fileName();
|
||||||
if (fileHandler)
|
if (fileHandler)
|
||||||
matches.append(filesWithSameFileName(lastSegment));
|
matches.append(filesWithSameFileName(lastSegment));
|
||||||
if (directoryHandler)
|
if (directoryHandler)
|
||||||
@@ -318,7 +318,7 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
|
|
||||||
// check if absolute path is found in sysroot
|
// check if absolute path is found in sysroot
|
||||||
if (!m_sysroot.isEmpty()) {
|
if (!m_sysroot.isEmpty()) {
|
||||||
const FileName sysrootPath = m_sysroot.pathAppended(originalPath);
|
const FilePath sysrootPath = m_sysroot.pathAppended(originalPath);
|
||||||
if (checkPath(sysrootPath.toString(), origLength, fileHandler, directoryHandler)) {
|
if (checkPath(sysrootPath.toString(), origLength, fileHandler, directoryHandler)) {
|
||||||
return handleSuccess(originalPath, QStringList(sysrootPath.toString()), origLength,
|
return handleSuccess(originalPath, QStringList(sysrootPath.toString()), origLength,
|
||||||
"in sysroot");
|
"in sysroot");
|
||||||
@@ -333,7 +333,7 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
FileInProjectFinder::CacheEntry FileInProjectFinder::findInSearchPaths(
|
FileInProjectFinder::CacheEntry FileInProjectFinder::findInSearchPaths(
|
||||||
const QString &filePath, FileHandler fileHandler, DirectoryHandler directoryHandler) const
|
const QString &filePath, FileHandler fileHandler, DirectoryHandler directoryHandler) const
|
||||||
{
|
{
|
||||||
for (const FileName &dirPath : m_searchDirectories) {
|
for (const FilePath &dirPath : m_searchDirectories) {
|
||||||
const CacheEntry found = findInSearchPath(dirPath.toString(), filePath,
|
const CacheEntry found = findInSearchPath(dirPath.toString(), filePath,
|
||||||
fileHandler, directoryHandler);
|
fileHandler, directoryHandler);
|
||||||
if (!found.paths.isEmpty())
|
if (!found.paths.isEmpty())
|
||||||
@@ -386,7 +386,7 @@ FileInProjectFinder::CacheEntry FileInProjectFinder::findInSearchPath(
|
|||||||
QStringList FileInProjectFinder::filesWithSameFileName(const QString &fileName) const
|
QStringList FileInProjectFinder::filesWithSameFileName(const QString &fileName) const
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
foreach (const FileName &f, m_projectFiles) {
|
foreach (const FilePath &f, m_projectFiles) {
|
||||||
if (f.fileName() == fileName)
|
if (f.fileName() == fileName)
|
||||||
result << f.toString();
|
result << f.toString();
|
||||||
}
|
}
|
||||||
@@ -396,8 +396,8 @@ QStringList FileInProjectFinder::filesWithSameFileName(const QString &fileName)
|
|||||||
QStringList FileInProjectFinder::pathSegmentsWithSameName(const QString &pathSegment) const
|
QStringList FileInProjectFinder::pathSegmentsWithSameName(const QString &pathSegment) const
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
for (const FileName &f : m_projectFiles) {
|
for (const FilePath &f : m_projectFiles) {
|
||||||
FileName currentPath = f.parentDir();
|
FilePath currentPath = f.parentDir();
|
||||||
do {
|
do {
|
||||||
if (currentPath.fileName() == pathSegment) {
|
if (currentPath.fileName() == pathSegment) {
|
||||||
if (result.isEmpty() || result.last() != currentPath.toString())
|
if (result.isEmpty() || result.last() != currentPath.toString())
|
||||||
@@ -446,12 +446,12 @@ QStringList FileInProjectFinder::bestMatches(const QStringList &filePaths,
|
|||||||
return bestFilePaths;
|
return bestFilePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileNameList FileInProjectFinder::searchDirectories() const
|
FilePathList FileInProjectFinder::searchDirectories() const
|
||||||
{
|
{
|
||||||
return m_searchDirectories;
|
return m_searchDirectories;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileInProjectFinder::setAdditionalSearchDirectories(const FileNameList &searchDirectories)
|
void FileInProjectFinder::setAdditionalSearchDirectories(const FilePathList &searchDirectories)
|
||||||
{
|
{
|
||||||
m_searchDirectories = searchDirectories;
|
m_searchDirectories = searchDirectories;
|
||||||
}
|
}
|
||||||
@@ -461,13 +461,13 @@ FileInProjectFinder::PathMappingNode::~PathMappingNode()
|
|||||||
qDeleteAll(children);
|
qDeleteAll(children);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileNameList FileInProjectFinder::QrcUrlFinder::find(const QUrl &fileUrl) const
|
FilePathList FileInProjectFinder::QrcUrlFinder::find(const QUrl &fileUrl) const
|
||||||
{
|
{
|
||||||
const auto fileIt = m_fileCache.constFind(fileUrl);
|
const auto fileIt = m_fileCache.constFind(fileUrl);
|
||||||
if (fileIt != m_fileCache.cend())
|
if (fileIt != m_fileCache.cend())
|
||||||
return fileIt.value();
|
return fileIt.value();
|
||||||
QStringList hits;
|
QStringList hits;
|
||||||
for (const FileName &f : m_allQrcFiles) {
|
for (const FilePath &f : m_allQrcFiles) {
|
||||||
QrcParser::Ptr &qrcParser = m_parserCache[f];
|
QrcParser::Ptr &qrcParser = m_parserCache[f];
|
||||||
if (!qrcParser)
|
if (!qrcParser)
|
||||||
qrcParser = QrcParser::parseQrcFile(f.toString(), QString());
|
qrcParser = QrcParser::parseQrcFile(f.toString(), QString());
|
||||||
@@ -476,28 +476,28 @@ FileNameList FileInProjectFinder::QrcUrlFinder::find(const QUrl &fileUrl) const
|
|||||||
qrcParser->collectFilesAtPath(QrcParser::normalizedQrcFilePath(fileUrl.toString()), &hits);
|
qrcParser->collectFilesAtPath(QrcParser::normalizedQrcFilePath(fileUrl.toString()), &hits);
|
||||||
}
|
}
|
||||||
hits.removeDuplicates();
|
hits.removeDuplicates();
|
||||||
const FileNameList result = transform(hits, &FileName::fromString);
|
const FilePathList result = transform(hits, &FilePath::fromString);
|
||||||
m_fileCache.insert(fileUrl, result);
|
m_fileCache.insert(fileUrl, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileInProjectFinder::QrcUrlFinder::setProjectFiles(const FileNameList &projectFiles)
|
void FileInProjectFinder::QrcUrlFinder::setProjectFiles(const FilePathList &projectFiles)
|
||||||
{
|
{
|
||||||
m_allQrcFiles = filtered(projectFiles, [](const FileName &f) { return f.endsWith(".qrc"); });
|
m_allQrcFiles = filtered(projectFiles, [](const FilePath &f) { return f.endsWith(".qrc"); });
|
||||||
m_fileCache.clear();
|
m_fileCache.clear();
|
||||||
m_parserCache.clear();
|
m_parserCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName chooseFileFromList(const FileNameList &candidates)
|
FilePath chooseFileFromList(const FilePathList &candidates)
|
||||||
{
|
{
|
||||||
if (candidates.length() == 1)
|
if (candidates.length() == 1)
|
||||||
return candidates.first();
|
return candidates.first();
|
||||||
QMenu filesMenu;
|
QMenu filesMenu;
|
||||||
for (const FileName &candidate : candidates)
|
for (const FilePath &candidate : candidates)
|
||||||
filesMenu.addAction(candidate.toUserOutput());
|
filesMenu.addAction(candidate.toUserOutput());
|
||||||
if (const QAction * const action = filesMenu.exec(QCursor::pos()))
|
if (const QAction * const action = filesMenu.exec(QCursor::pos()))
|
||||||
return FileName::fromUserInput(action->text());
|
return FilePath::fromUserInput(action->text());
|
||||||
return FileName();
|
return FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
@@ -47,26 +47,26 @@ public:
|
|||||||
FileInProjectFinder();
|
FileInProjectFinder();
|
||||||
~FileInProjectFinder();
|
~FileInProjectFinder();
|
||||||
|
|
||||||
void setProjectDirectory(const FileName &absoluteProjectPath);
|
void setProjectDirectory(const FilePath &absoluteProjectPath);
|
||||||
FileName projectDirectory() const;
|
FilePath projectDirectory() const;
|
||||||
|
|
||||||
void setProjectFiles(const FileNameList &projectFiles);
|
void setProjectFiles(const FilePathList &projectFiles);
|
||||||
void setSysroot(const FileName &sysroot);
|
void setSysroot(const FilePath &sysroot);
|
||||||
|
|
||||||
void addMappedPath(const FileName &localFilePath, const QString &remoteFilePath);
|
void addMappedPath(const FilePath &localFilePath, const QString &remoteFilePath);
|
||||||
|
|
||||||
FileNameList findFile(const QUrl &fileUrl, bool *success = nullptr) const;
|
FilePathList findFile(const QUrl &fileUrl, bool *success = nullptr) const;
|
||||||
bool findFileOrDirectory(const QString &originalPath, FileHandler fileHandler = nullptr,
|
bool findFileOrDirectory(const QString &originalPath, FileHandler fileHandler = nullptr,
|
||||||
DirectoryHandler directoryHandler = nullptr) const;
|
DirectoryHandler directoryHandler = nullptr) const;
|
||||||
|
|
||||||
FileNameList searchDirectories() const;
|
FilePathList searchDirectories() const;
|
||||||
void setAdditionalSearchDirectories(const FileNameList &searchDirectories);
|
void setAdditionalSearchDirectories(const FilePathList &searchDirectories);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PathMappingNode
|
struct PathMappingNode
|
||||||
{
|
{
|
||||||
~PathMappingNode();
|
~PathMappingNode();
|
||||||
FileName localPath;
|
FilePath localPath;
|
||||||
QHash<QString, PathMappingNode *> children;
|
QHash<QString, PathMappingNode *> children;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -77,12 +77,12 @@ private:
|
|||||||
|
|
||||||
class QrcUrlFinder {
|
class QrcUrlFinder {
|
||||||
public:
|
public:
|
||||||
FileNameList find(const QUrl &fileUrl) const;
|
FilePathList find(const QUrl &fileUrl) const;
|
||||||
void setProjectFiles(const FileNameList &projectFiles);
|
void setProjectFiles(const FilePathList &projectFiles);
|
||||||
private:
|
private:
|
||||||
FileNameList m_allQrcFiles;
|
FilePathList m_allQrcFiles;
|
||||||
mutable QHash<QUrl, FileNameList> m_fileCache;
|
mutable QHash<QUrl, FilePathList> m_fileCache;
|
||||||
mutable QHash<FileName, QSharedPointer<QrcParser>> m_parserCache;
|
mutable QHash<FilePath, QSharedPointer<QrcParser>> m_parserCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
CacheEntry findInSearchPaths(const QString &filePath, FileHandler fileHandler,
|
CacheEntry findInSearchPaths(const QString &filePath, FileHandler fileHandler,
|
||||||
@@ -98,16 +98,16 @@ private:
|
|||||||
static int commonPostFixLength(const QString &candidatePath, const QString &filePathToFind);
|
static int commonPostFixLength(const QString &candidatePath, const QString &filePathToFind);
|
||||||
static QStringList bestMatches(const QStringList &filePaths, const QString &filePathToFind);
|
static QStringList bestMatches(const QStringList &filePaths, const QString &filePathToFind);
|
||||||
|
|
||||||
FileName m_projectDir;
|
FilePath m_projectDir;
|
||||||
FileName m_sysroot;
|
FilePath m_sysroot;
|
||||||
FileNameList m_projectFiles;
|
FilePathList m_projectFiles;
|
||||||
FileNameList m_searchDirectories;
|
FilePathList m_searchDirectories;
|
||||||
PathMappingNode m_pathMapRoot;
|
PathMappingNode m_pathMapRoot;
|
||||||
|
|
||||||
mutable QHash<QString, CacheEntry> m_cache;
|
mutable QHash<QString, CacheEntry> m_cache;
|
||||||
QrcUrlFinder m_qrcUrlFinder;
|
QrcUrlFinder m_qrcUrlFinder;
|
||||||
};
|
};
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT FileName chooseFileFromList(const FileNameList &candidates);
|
QTCREATOR_UTILS_EXPORT FilePath chooseFileFromList(const FilePathList &candidates);
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
@@ -482,7 +482,7 @@ static bool matches(const QList<QRegExp> &exprList, const QString &filePath)
|
|||||||
{
|
{
|
||||||
return Utils::anyOf(exprList, [&filePath](QRegExp reg) {
|
return Utils::anyOf(exprList, [&filePath](QRegExp reg) {
|
||||||
return (reg.exactMatch(filePath)
|
return (reg.exactMatch(filePath)
|
||||||
|| reg.exactMatch(FileName::fromString(filePath).fileName()));
|
|| reg.exactMatch(FilePath::fromString(filePath).fileName()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
QDebug operator<<(QDebug dbg, const Utils::FileName &c)
|
QDebug operator<<(QDebug dbg, const Utils::FilePath &c)
|
||||||
{
|
{
|
||||||
return dbg << c.toString();
|
return dbg << c.toString();
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ namespace Utils {
|
|||||||
|
|
||||||
Returns whether the operation succeeded.
|
Returns whether the operation succeeded.
|
||||||
*/
|
*/
|
||||||
bool FileUtils::removeRecursively(const FileName &filePath, QString *error)
|
bool FileUtils::removeRecursively(const FilePath &filePath, QString *error)
|
||||||
{
|
{
|
||||||
QFileInfo fileInfo = filePath.toFileInfo();
|
QFileInfo fileInfo = filePath.toFileInfo();
|
||||||
if (!fileInfo.exists() && !fileInfo.isSymLink())
|
if (!fileInfo.exists() && !fileInfo.isSymLink())
|
||||||
@@ -146,7 +146,7 @@ bool FileUtils::removeRecursively(const FileName &filePath, QString *error)
|
|||||||
|
|
||||||
Returns whether the operation succeeded.
|
Returns whether the operation succeeded.
|
||||||
*/
|
*/
|
||||||
bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgtFilePath,
|
bool FileUtils::copyRecursively(const FilePath &srcFilePath, const FilePath &tgtFilePath,
|
||||||
QString *error, const std::function<bool (QFileInfo, QFileInfo, QString *)> ©Helper)
|
QString *error, const std::function<bool (QFileInfo, QFileInfo, QString *)> ©Helper)
|
||||||
{
|
{
|
||||||
QFileInfo srcFileInfo = srcFilePath.toFileInfo();
|
QFileInfo srcFileInfo = srcFilePath.toFileInfo();
|
||||||
@@ -166,8 +166,8 @@ bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgt
|
|||||||
QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot
|
QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot
|
||||||
| QDir::Hidden | QDir::System);
|
| QDir::Hidden | QDir::System);
|
||||||
foreach (const QString &fileName, fileNames) {
|
foreach (const QString &fileName, fileNames) {
|
||||||
const FileName newSrcFilePath = srcFilePath.pathAppended(fileName);
|
const FilePath newSrcFilePath = srcFilePath.pathAppended(fileName);
|
||||||
const FileName newTgtFilePath = tgtFilePath.pathAppended(fileName);
|
const FilePath newTgtFilePath = tgtFilePath.pathAppended(fileName);
|
||||||
if (!copyRecursively(newSrcFilePath, newTgtFilePath, error, copyHelper))
|
if (!copyRecursively(newSrcFilePath, newTgtFilePath, error, copyHelper))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgt
|
|||||||
Returns whether at least one file in \a filePath has a newer date than
|
Returns whether at least one file in \a filePath has a newer date than
|
||||||
\a timeStamp.
|
\a timeStamp.
|
||||||
*/
|
*/
|
||||||
bool FileName::isNewerThan(const QDateTime &timeStamp) const
|
bool FilePath::isNewerThan(const QDateTime &timeStamp) const
|
||||||
{
|
{
|
||||||
const QFileInfo fileInfo = toFileInfo();
|
const QFileInfo fileInfo = toFileInfo();
|
||||||
if (!fileInfo.exists() || fileInfo.lastModified() >= timeStamp)
|
if (!fileInfo.exists() || fileInfo.lastModified() >= timeStamp)
|
||||||
@@ -222,15 +222,15 @@ bool FileName::isNewerThan(const QDateTime &timeStamp) const
|
|||||||
|
|
||||||
Returns the symlink target file path.
|
Returns the symlink target file path.
|
||||||
*/
|
*/
|
||||||
FileName FileUtils::resolveSymlinks(const FileName &path)
|
FilePath FileUtils::resolveSymlinks(const FilePath &path)
|
||||||
{
|
{
|
||||||
QFileInfo f = path.toFileInfo();
|
QFileInfo f = path.toFileInfo();
|
||||||
int links = 16;
|
int links = 16;
|
||||||
while (links-- && f.isSymLink())
|
while (links-- && f.isSymLink())
|
||||||
f.setFile(f.dir(), f.symLinkTarget());
|
f.setFile(f.dir(), f.symLinkTarget());
|
||||||
if (links <= 0)
|
if (links <= 0)
|
||||||
return FileName();
|
return FilePath();
|
||||||
return FileName::fromString(f.filePath());
|
return FilePath::fromString(f.filePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -240,12 +240,12 @@ FileName FileUtils::resolveSymlinks(const FileName &path)
|
|||||||
|
|
||||||
Returns the canonical path.
|
Returns the canonical path.
|
||||||
*/
|
*/
|
||||||
FileName FileName::canonicalPath() const
|
FilePath FilePath::canonicalPath() const
|
||||||
{
|
{
|
||||||
const QString result = toFileInfo().canonicalFilePath();
|
const QString result = toFileInfo().canonicalFilePath();
|
||||||
if (result.isEmpty())
|
if (result.isEmpty())
|
||||||
return *this;
|
return *this;
|
||||||
return FileName::fromString(result);
|
return FilePath::fromString(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -254,10 +254,10 @@ FileName FileName::canonicalPath() const
|
|||||||
|
|
||||||
Returns the possibly shortened path with native separators.
|
Returns the possibly shortened path with native separators.
|
||||||
*/
|
*/
|
||||||
QString FileName::shortNativePath() const
|
QString FilePath::shortNativePath() const
|
||||||
{
|
{
|
||||||
if (HostOsInfo::isAnyUnixHost()) {
|
if (HostOsInfo::isAnyUnixHost()) {
|
||||||
const FileName home = FileName::fromString(QDir::cleanPath(QDir::homePath()));
|
const FilePath home = FilePath::fromString(QDir::cleanPath(QDir::homePath()));
|
||||||
if (isChildOf(home)) {
|
if (isChildOf(home)) {
|
||||||
return QLatin1Char('~') + QDir::separator()
|
return QLatin1Char('~') + QDir::separator()
|
||||||
+ QDir::toNativeSeparators(relativeChildPath(home).toString());
|
+ QDir::toNativeSeparators(relativeChildPath(home).toString());
|
||||||
@@ -297,7 +297,7 @@ QString FileUtils::qmakeFriendlyName(const QString &name)
|
|||||||
return fileSystemFriendlyName(result);
|
return fileSystemFriendlyName(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileUtils::makeWritable(const FileName &path)
|
bool FileUtils::makeWritable(const FilePath &path)
|
||||||
{
|
{
|
||||||
const QString fileName = path.toString();
|
const QString fileName = path.toString();
|
||||||
return QFile::setPermissions(fileName, QFile::permissions(fileName) | QFile::WriteUser);
|
return QFile::setPermissions(fileName, QFile::permissions(fileName) | QFile::WriteUser);
|
||||||
@@ -351,9 +351,9 @@ QString FileUtils::resolvePath(const QString &baseDir, const QString &fileName)
|
|||||||
return QDir::cleanPath(baseDir + QLatin1Char('/') + fileName);
|
return QDir::cleanPath(baseDir + QLatin1Char('/') + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName FileUtils::commonPath(const FileName &oldCommonPath, const FileName &fileName)
|
FilePath FileUtils::commonPath(const FilePath &oldCommonPath, const FilePath &fileName)
|
||||||
{
|
{
|
||||||
FileName newCommonPath = oldCommonPath;
|
FilePath newCommonPath = oldCommonPath;
|
||||||
while (!newCommonPath.isEmpty() && !fileName.isChildOf(newCommonPath))
|
while (!newCommonPath.isEmpty() && !fileName.isChildOf(newCommonPath))
|
||||||
newCommonPath = newCommonPath.parentDir();
|
newCommonPath = newCommonPath.parentDir();
|
||||||
return newCommonPath.canonicalPath();
|
return newCommonPath.canonicalPath();
|
||||||
@@ -400,7 +400,7 @@ static QByteArray fileIdWin(HANDLE fHandle)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QByteArray FileUtils::fileId(const FileName &fileName)
|
QByteArray FileUtils::fileId(const FilePath &fileName)
|
||||||
{
|
{
|
||||||
QByteArray result;
|
QByteArray result;
|
||||||
|
|
||||||
@@ -632,51 +632,51 @@ TempFileSaver::~TempFileSaver()
|
|||||||
On windows filenames are compared case insensitively.
|
On windows filenames are compared case insensitively.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FileName::FileName()
|
FilePath::FilePath()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a FileName from \a info
|
/// Constructs a FileName from \a info
|
||||||
FileName FileName::fromFileInfo(const QFileInfo &info)
|
FilePath FilePath::fromFileInfo(const QFileInfo &info)
|
||||||
{
|
{
|
||||||
return FileName::fromString(info.absoluteFilePath());
|
return FilePath::fromString(info.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \returns a QFileInfo
|
/// \returns a QFileInfo
|
||||||
QFileInfo FileName::toFileInfo() const
|
QFileInfo FilePath::toFileInfo() const
|
||||||
{
|
{
|
||||||
return QFileInfo(m_data);
|
return QFileInfo(m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName FileName::fromUrl(const QUrl &url)
|
FilePath FilePath::fromUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
FileName fn;
|
FilePath fn;
|
||||||
fn.m_url = url;
|
fn.m_url = url;
|
||||||
fn.m_data = url.path();
|
fn.m_data = url.path();
|
||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \returns a QString for passing on to QString based APIs
|
/// \returns a QString for passing on to QString based APIs
|
||||||
const QString &FileName::toString() const
|
const QString &FilePath::toString() const
|
||||||
{
|
{
|
||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl FileName::toUrl() const
|
QUrl FilePath::toUrl() const
|
||||||
{
|
{
|
||||||
return m_url;
|
return m_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \returns a QString to display to the user
|
/// \returns a QString to display to the user
|
||||||
/// Converts the separators to the native format
|
/// Converts the separators to the native format
|
||||||
QString FileName::toUserOutput() const
|
QString FilePath::toUserOutput() const
|
||||||
{
|
{
|
||||||
if (m_url.isEmpty())
|
if (m_url.isEmpty())
|
||||||
return QDir::toNativeSeparators(toString());
|
return QDir::toNativeSeparators(toString());
|
||||||
return m_url.toString();
|
return m_url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FileName::fileName(int pathComponents) const
|
QString FilePath::fileName(int pathComponents) const
|
||||||
{
|
{
|
||||||
if (pathComponents < 0)
|
if (pathComponents < 0)
|
||||||
return m_data;
|
return m_data;
|
||||||
@@ -703,7 +703,7 @@ QString FileName::fileName(int pathComponents) const
|
|||||||
|
|
||||||
/// \returns a bool indicating whether a file with this
|
/// \returns a bool indicating whether a file with this
|
||||||
/// FileName exists.
|
/// FileName exists.
|
||||||
bool FileName::exists() const
|
bool FilePath::exists() const
|
||||||
{
|
{
|
||||||
return !isEmpty() && QFileInfo::exists(m_data);
|
return !isEmpty() && QFileInfo::exists(m_data);
|
||||||
}
|
}
|
||||||
@@ -714,28 +714,28 @@ bool FileName::exists() const
|
|||||||
/// a root level directory.
|
/// a root level directory.
|
||||||
|
|
||||||
/// \returns \a FileName with the last segment removed.
|
/// \returns \a FileName with the last segment removed.
|
||||||
FileName FileName::parentDir() const
|
FilePath FilePath::parentDir() const
|
||||||
{
|
{
|
||||||
const QString basePath = toString();
|
const QString basePath = toString();
|
||||||
if (basePath.isEmpty())
|
if (basePath.isEmpty())
|
||||||
return FileName();
|
return FilePath();
|
||||||
|
|
||||||
const QDir base(basePath);
|
const QDir base(basePath);
|
||||||
if (base.isRoot())
|
if (base.isRoot())
|
||||||
return FileName();
|
return FilePath();
|
||||||
|
|
||||||
const QString path = basePath + QLatin1String("/..");
|
const QString path = basePath + QLatin1String("/..");
|
||||||
const QString parent = QDir::cleanPath(path);
|
const QString parent = QDir::cleanPath(path);
|
||||||
QTC_ASSERT(parent != path, return FileName());
|
QTC_ASSERT(parent != path, return FilePath());
|
||||||
|
|
||||||
return FileName::fromString(parent);
|
return FilePath::fromString(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a FileName from \a filename
|
/// Constructs a FileName from \a filename
|
||||||
/// \a filename is not checked for validity.
|
/// \a filename is not checked for validity.
|
||||||
FileName FileName::fromString(const QString &filename)
|
FilePath FilePath::fromString(const QString &filename)
|
||||||
{
|
{
|
||||||
FileName fn;
|
FilePath fn;
|
||||||
fn.m_data = filename;
|
fn.m_data = filename;
|
||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
@@ -743,13 +743,13 @@ FileName FileName::fromString(const QString &filename)
|
|||||||
/// Constructs a FileName from \a fileName. The \a defaultExtension is appended
|
/// Constructs a FileName from \a fileName. The \a defaultExtension is appended
|
||||||
/// to \a filename if that does not have an extension already.
|
/// to \a filename if that does not have an extension already.
|
||||||
/// \a fileName is not checked for validity.
|
/// \a fileName is not checked for validity.
|
||||||
FileName FileName::fromStringWithExtension(const QString &filename, const QString &defaultExtension)
|
FilePath FilePath::fromStringWithExtension(const QString &filepath, const QString &defaultExtension)
|
||||||
{
|
{
|
||||||
if (filename.isEmpty() || defaultExtension.isEmpty())
|
if (filepath.isEmpty() || defaultExtension.isEmpty())
|
||||||
return FileName::fromString(filename);
|
return FilePath::fromString(filepath);
|
||||||
|
|
||||||
QString rc = filename;
|
QString rc = filepath;
|
||||||
QFileInfo fi(filename);
|
QFileInfo fi(filepath);
|
||||||
// Add extension unless user specified something else
|
// Add extension unless user specified something else
|
||||||
const QChar dot = QLatin1Char('.');
|
const QChar dot = QLatin1Char('.');
|
||||||
if (!fi.fileName().contains(dot)) {
|
if (!fi.fileName().contains(dot)) {
|
||||||
@@ -757,88 +757,88 @@ FileName FileName::fromStringWithExtension(const QString &filename, const QStrin
|
|||||||
rc += dot;
|
rc += dot;
|
||||||
rc += defaultExtension;
|
rc += defaultExtension;
|
||||||
}
|
}
|
||||||
return FileName::fromString(rc);
|
return FilePath::fromString(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a FileName from \a fileName
|
/// Constructs a FileName from \a fileName
|
||||||
/// \a fileName is not checked for validity.
|
/// \a fileName is not checked for validity.
|
||||||
FileName FileName::fromLatin1(const QByteArray &filename)
|
FilePath FilePath::fromLatin1(const QByteArray &filename)
|
||||||
{
|
{
|
||||||
return FileName::fromString(QString::fromLatin1(filename));
|
return FilePath::fromString(QString::fromLatin1(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a FileName from \a fileName
|
/// Constructs a FileName from \a fileName
|
||||||
/// \a fileName is only passed through QDir::cleanPath
|
/// \a fileName is only passed through QDir::cleanPath
|
||||||
FileName FileName::fromUserInput(const QString &filename)
|
FilePath FilePath::fromUserInput(const QString &filename)
|
||||||
{
|
{
|
||||||
QString clean = QDir::cleanPath(filename);
|
QString clean = QDir::cleanPath(filename);
|
||||||
if (clean.startsWith(QLatin1String("~/")))
|
if (clean.startsWith(QLatin1String("~/")))
|
||||||
clean = QDir::homePath() + clean.mid(1);
|
clean = QDir::homePath() + clean.mid(1);
|
||||||
return FileName::fromString(clean);
|
return FilePath::fromString(clean);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a FileName from \a fileName, which is encoded as UTF-8.
|
/// Constructs a FileName from \a fileName, which is encoded as UTF-8.
|
||||||
/// \a fileName is not checked for validity.
|
/// \a fileName is not checked for validity.
|
||||||
FileName FileName::fromUtf8(const char *filename, int filenameSize)
|
FilePath FilePath::fromUtf8(const char *filename, int filenameSize)
|
||||||
{
|
{
|
||||||
return FileName::fromString(QString::fromUtf8(filename, filenameSize));
|
return FilePath::fromString(QString::fromUtf8(filename, filenameSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName FileName::fromVariant(const QVariant &variant)
|
FilePath FilePath::fromVariant(const QVariant &variant)
|
||||||
{
|
{
|
||||||
if (variant.type() == QVariant::Url)
|
if (variant.type() == QVariant::Url)
|
||||||
return FileName::fromUrl(variant.toUrl());
|
return FilePath::fromUrl(variant.toUrl());
|
||||||
return FileName::fromString(variant.toString());
|
return FilePath::fromString(variant.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant FileName::toVariant() const
|
QVariant FilePath::toVariant() const
|
||||||
{
|
{
|
||||||
if (!m_url.isEmpty())
|
if (!m_url.isEmpty())
|
||||||
return m_url;
|
return m_url;
|
||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileName::operator==(const FileName &other) const
|
bool FilePath::operator==(const FilePath &other) const
|
||||||
{
|
{
|
||||||
if (!m_url.isEmpty())
|
if (!m_url.isEmpty())
|
||||||
return m_url == other.m_url;
|
return m_url == other.m_url;
|
||||||
return QString::compare(m_data, other.m_data, HostOsInfo::fileNameCaseSensitivity()) == 0;
|
return QString::compare(m_data, other.m_data, HostOsInfo::fileNameCaseSensitivity()) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileName::operator!=(const FileName &other) const
|
bool FilePath::operator!=(const FilePath &other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileName::operator<(const FileName &other) const
|
bool FilePath::operator<(const FilePath &other) const
|
||||||
{
|
{
|
||||||
if (!m_url.isEmpty())
|
if (!m_url.isEmpty())
|
||||||
return m_url < other.m_url;
|
return m_url < other.m_url;
|
||||||
return QString::compare(m_data, other.m_data, HostOsInfo::fileNameCaseSensitivity()) < 0;
|
return QString::compare(m_data, other.m_data, HostOsInfo::fileNameCaseSensitivity()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileName::operator<=(const FileName &other) const
|
bool FilePath::operator<=(const FilePath &other) const
|
||||||
{
|
{
|
||||||
return !(other < *this);
|
return !(other < *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileName::operator>(const FileName &other) const
|
bool FilePath::operator>(const FilePath &other) const
|
||||||
{
|
{
|
||||||
return other < *this;
|
return other < *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileName::operator>=(const FileName &other) const
|
bool FilePath::operator>=(const FilePath &other) const
|
||||||
{
|
{
|
||||||
return !(*this < other);
|
return !(*this < other);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName FileName::operator+(const QString &s) const
|
FilePath FilePath::operator+(const QString &s) const
|
||||||
{
|
{
|
||||||
return FileName::fromString(m_data + s);
|
return FilePath::fromString(m_data + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \returns whether FileName is a child of \a s
|
/// \returns whether FileName is a child of \a s
|
||||||
bool FileName::isChildOf(const FileName &s) const
|
bool FilePath::isChildOf(const FilePath &s) const
|
||||||
{
|
{
|
||||||
if (s.isEmpty())
|
if (s.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
@@ -854,18 +854,18 @@ bool FileName::isChildOf(const FileName &s) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// \overload
|
/// \overload
|
||||||
bool FileName::isChildOf(const QDir &dir) const
|
bool FilePath::isChildOf(const QDir &dir) const
|
||||||
{
|
{
|
||||||
return isChildOf(FileName::fromString(dir.absolutePath()));
|
return isChildOf(FilePath::fromString(dir.absolutePath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \returns whether FileName endsWith \a s
|
/// \returns whether FileName endsWith \a s
|
||||||
bool FileName::endsWith(const QString &s) const
|
bool FilePath::endsWith(const QString &s) const
|
||||||
{
|
{
|
||||||
return m_data.endsWith(s, HostOsInfo::fileNameCaseSensitivity());
|
return m_data.endsWith(s, HostOsInfo::fileNameCaseSensitivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileName::isLocal() const
|
bool FilePath::isLocal() const
|
||||||
{
|
{
|
||||||
return m_url.isEmpty() || m_url.isLocalFile();
|
return m_url.isEmpty() || m_url.isLocalFile();
|
||||||
}
|
}
|
||||||
@@ -873,16 +873,16 @@ bool FileName::isLocal() const
|
|||||||
/// \returns the relativeChildPath of FileName to parent if FileName is a child of parent
|
/// \returns the relativeChildPath of FileName to parent if FileName is a child of parent
|
||||||
/// \note returns a empty FileName if FileName is not a child of parent
|
/// \note returns a empty FileName if FileName is not a child of parent
|
||||||
/// That is, this never returns a path starting with "../"
|
/// That is, this never returns a path starting with "../"
|
||||||
FileName FileName::relativeChildPath(const FileName &parent) const
|
FilePath FilePath::relativeChildPath(const FilePath &parent) const
|
||||||
{
|
{
|
||||||
if (!isChildOf(parent))
|
if (!isChildOf(parent))
|
||||||
return FileName();
|
return FilePath();
|
||||||
return FileName::fromString(m_data.mid(parent.m_data.size() + 1, -1));
|
return FilePath::fromString(m_data.mid(parent.m_data.size() + 1, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName FileName::pathAppended(const QString &str) const
|
FilePath FilePath::pathAppended(const QString &str) const
|
||||||
{
|
{
|
||||||
FileName fn = *this;
|
FilePath fn = *this;
|
||||||
if (str.isEmpty())
|
if (str.isEmpty())
|
||||||
return fn;
|
return fn;
|
||||||
if (!isEmpty() && !m_data.endsWith(QLatin1Char('/')))
|
if (!isEmpty() && !m_data.endsWith(QLatin1Char('/')))
|
||||||
@@ -891,21 +891,21 @@ FileName FileName::pathAppended(const QString &str) const
|
|||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName FileName::stringAppended(const QString &str) const
|
FilePath FilePath::stringAppended(const QString &str) const
|
||||||
{
|
{
|
||||||
FileName fn = *this;
|
FilePath fn = *this;
|
||||||
fn.m_data.append(str);
|
fn.m_data.append(str);
|
||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint FileName::hash(uint seed) const
|
uint FilePath::hash(uint seed) const
|
||||||
{
|
{
|
||||||
if (Utils::HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive)
|
if (Utils::HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive)
|
||||||
return qHash(m_data.toUpper(), seed);
|
return qHash(m_data.toUpper(), seed);
|
||||||
return qHash(m_data, seed);
|
return qHash(m_data, seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream &operator<<(QTextStream &s, const FileName &fn)
|
QTextStream &operator<<(QTextStream &s, const FilePath &fn)
|
||||||
{
|
{
|
||||||
return s << fn.toString();
|
return s << fn.toString();
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace Utils {class FileName; }
|
namespace Utils { class FilePath; }
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QDataStream;
|
class QDataStream;
|
||||||
@@ -50,7 +50,7 @@ class QTemporaryFile;
|
|||||||
class QTextStream;
|
class QTextStream;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug dbg, const Utils::FileName &c);
|
QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug dbg, const Utils::FilePath &c);
|
||||||
|
|
||||||
// for withNtfsPermissions
|
// for withNtfsPermissions
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@@ -61,18 +61,18 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT FileName
|
class QTCREATOR_UTILS_EXPORT FilePath
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FileName();
|
FilePath();
|
||||||
|
|
||||||
static FileName fromString(const QString &filename);
|
static FilePath fromString(const QString &filepath);
|
||||||
static FileName fromFileInfo(const QFileInfo &info);
|
static FilePath fromFileInfo(const QFileInfo &info);
|
||||||
static FileName fromStringWithExtension(const QString &filename, const QString &defaultExtension);
|
static FilePath fromStringWithExtension(const QString &filepath, const QString &defaultExtension);
|
||||||
static FileName fromLatin1(const QByteArray &filename);
|
static FilePath fromLatin1(const QByteArray &filepath);
|
||||||
static FileName fromUserInput(const QString &filename);
|
static FilePath fromUserInput(const QString &filepath);
|
||||||
static FileName fromUtf8(const char *filename, int filenameSize = -1);
|
static FilePath fromUtf8(const char *filepath, int filepathSize = -1);
|
||||||
static FileName fromVariant(const QVariant &variant);
|
static FilePath fromVariant(const QVariant &variant);
|
||||||
|
|
||||||
const QString &toString() const;
|
const QString &toString() const;
|
||||||
QFileInfo toFileInfo() const;
|
QFileInfo toFileInfo() const;
|
||||||
@@ -84,37 +84,37 @@ public:
|
|||||||
QString fileName(int pathComponents = 0) const;
|
QString fileName(int pathComponents = 0) const;
|
||||||
bool exists() const;
|
bool exists() const;
|
||||||
|
|
||||||
FileName parentDir() const;
|
FilePath parentDir() const;
|
||||||
|
|
||||||
bool operator==(const FileName &other) const;
|
bool operator==(const FilePath &other) const;
|
||||||
bool operator!=(const FileName &other) const;
|
bool operator!=(const FilePath &other) const;
|
||||||
bool operator<(const FileName &other) const;
|
bool operator<(const FilePath &other) const;
|
||||||
bool operator<=(const FileName &other) const;
|
bool operator<=(const FilePath &other) const;
|
||||||
bool operator>(const FileName &other) const;
|
bool operator>(const FilePath &other) const;
|
||||||
bool operator>=(const FileName &other) const;
|
bool operator>=(const FilePath &other) const;
|
||||||
FileName operator+(const QString &s) const;
|
FilePath operator+(const QString &s) const;
|
||||||
|
|
||||||
bool isChildOf(const FileName &s) const;
|
bool isChildOf(const FilePath &s) const;
|
||||||
bool isChildOf(const QDir &dir) const;
|
bool isChildOf(const QDir &dir) const;
|
||||||
bool endsWith(const QString &s) const;
|
bool endsWith(const QString &s) const;
|
||||||
bool isLocal() const;
|
bool isLocal() const;
|
||||||
|
|
||||||
bool isNewerThan(const QDateTime &timeStamp) const;
|
bool isNewerThan(const QDateTime &timeStamp) const;
|
||||||
|
|
||||||
FileName relativeChildPath(const FileName &parent) const;
|
FilePath relativeChildPath(const FilePath &parent) const;
|
||||||
FileName pathAppended(const QString &str) const;
|
FilePath pathAppended(const QString &str) const;
|
||||||
FileName stringAppended(const QString &str) const;
|
FilePath stringAppended(const QString &str) const;
|
||||||
|
|
||||||
FileName canonicalPath() const;
|
FilePath canonicalPath() const;
|
||||||
|
|
||||||
void clear() { m_data.clear(); }
|
void clear() { m_data.clear(); }
|
||||||
bool isEmpty() const { return m_data.isEmpty(); }
|
bool isEmpty() const { return m_data.isEmpty(); }
|
||||||
|
|
||||||
uint hash(uint seed) const;
|
uint hash(uint seed) const;
|
||||||
|
|
||||||
// NOTE: FileName operations on FileName created from URL currenly
|
// NOTE: FileName operations on FilePath created from URL currenly
|
||||||
// do not work except for .toVariant() and .toUrl().
|
// do not work except for .toVariant() and .toUrl().
|
||||||
static FileName fromUrl(const QUrl &url);
|
static FilePath fromUrl(const QUrl &url);
|
||||||
QUrl toUrl() const;
|
QUrl toUrl() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -122,28 +122,31 @@ private:
|
|||||||
QUrl m_url;
|
QUrl m_url;
|
||||||
};
|
};
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT QTextStream &operator<<(QTextStream &s, const FileName &fn);
|
QTCREATOR_UTILS_EXPORT QTextStream &operator<<(QTextStream &s, const FilePath &fn);
|
||||||
|
|
||||||
using FileNameList = QList<FileName>;
|
using FilePathList = QList<FilePath>;
|
||||||
|
|
||||||
|
using FileName = FilePath;
|
||||||
|
using FileNameList = FilePathList;
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT FileUtils {
|
class QTCREATOR_UTILS_EXPORT FileUtils {
|
||||||
public:
|
public:
|
||||||
static bool removeRecursively(const FileName &filePath, QString *error = nullptr);
|
static bool removeRecursively(const FilePath &filePath, QString *error = nullptr);
|
||||||
static bool copyRecursively(
|
static bool copyRecursively(
|
||||||
const FileName &srcFilePath, const FileName &tgtFilePath, QString *error = nullptr,
|
const FilePath &srcFilePath, const FilePath &tgtFilePath, QString *error = nullptr,
|
||||||
const std::function<bool (QFileInfo, QFileInfo, QString *)> ©Helper = nullptr);
|
const std::function<bool (QFileInfo, QFileInfo, QString *)> ©Helper = nullptr);
|
||||||
static FileName resolveSymlinks(const FileName &path);
|
static FilePath resolveSymlinks(const FilePath &path);
|
||||||
static QString fileSystemFriendlyName(const QString &name);
|
static QString fileSystemFriendlyName(const QString &name);
|
||||||
static int indexOfQmakeUnfriendly(const QString &name, int startpos = 0);
|
static int indexOfQmakeUnfriendly(const QString &name, int startpos = 0);
|
||||||
static QString qmakeFriendlyName(const QString &name);
|
static QString qmakeFriendlyName(const QString &name);
|
||||||
static bool makeWritable(const FileName &path);
|
static bool makeWritable(const FilePath &path);
|
||||||
static QString normalizePathName(const QString &name);
|
static QString normalizePathName(const QString &name);
|
||||||
|
|
||||||
static bool isRelativePath(const QString &fileName);
|
static bool isRelativePath(const QString &fileName);
|
||||||
static bool isAbsolutePath(const QString &fileName) { return !isRelativePath(fileName); }
|
static bool isAbsolutePath(const QString &fileName) { return !isRelativePath(fileName); }
|
||||||
static QString resolvePath(const QString &baseDir, const QString &fileName);
|
static QString resolvePath(const QString &baseDir, const QString &fileName);
|
||||||
static FileName commonPath(const FileName &oldCommonPath, const FileName &fileName);
|
static FilePath commonPath(const FilePath &oldCommonPath, const FilePath &fileName);
|
||||||
static QByteArray fileId(const FileName &fileName);
|
static QByteArray fileId(const FilePath &fileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
// for actually finding out if e.g. directories are writable on Windows
|
// for actually finding out if e.g. directories are writable on Windows
|
||||||
@@ -254,14 +257,14 @@ private:
|
|||||||
bool m_autoRemove = true;
|
bool m_autoRemove = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline uint qHash(const Utils::FileName &a, uint seed = 0) { return a.hash(seed); }
|
inline uint qHash(const Utils::FilePath &a, uint seed = 0) { return a.hash(seed); }
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
template<> struct hash<Utils::FileName>
|
template<> struct hash<Utils::FilePath>
|
||||||
{
|
{
|
||||||
using argument_type = Utils::FileName;
|
using argument_type = Utils::FilePath;
|
||||||
using result_type = size_t;
|
using result_type = size_t;
|
||||||
result_type operator()(const argument_type &fn) const
|
result_type operator()(const argument_type &fn) const
|
||||||
{
|
{
|
||||||
@@ -272,4 +275,4 @@ template<> struct hash<Utils::FileName>
|
|||||||
};
|
};
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Utils::FileName)
|
Q_DECLARE_METATYPE(Utils::FilePath)
|
||||||
|
@@ -290,9 +290,9 @@ QString MacroExpander::expand(const QString &stringWithVariables) const
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName MacroExpander::expand(const FileName &fileNameWithVariables) const
|
FilePath MacroExpander::expand(const FilePath &fileNameWithVariables) const
|
||||||
{
|
{
|
||||||
return FileName::fromString(expand(fileNameWithVariables.toString()));
|
return FilePath::fromString(expand(fileNameWithVariables.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray MacroExpander::expand(const QByteArray &stringWithVariables) const
|
QByteArray MacroExpander::expand(const QByteArray &stringWithVariables) const
|
||||||
@@ -422,7 +422,7 @@ void MacroExpander::registerFileVariables(const QByteArray &prefix,
|
|||||||
|
|
||||||
registerVariable(prefix + kFileNamePostfix,
|
registerVariable(prefix + kFileNamePostfix,
|
||||||
tr("%1: File name without path.").arg(heading),
|
tr("%1: File name without path.").arg(heading),
|
||||||
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : FileName::fromString(tmp).fileName(); },
|
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : FilePath::fromString(tmp).fileName(); },
|
||||||
visibleInChooser);
|
visibleInChooser);
|
||||||
|
|
||||||
registerVariable(prefix + kFileBaseNamePostfix,
|
registerVariable(prefix + kFileBaseNamePostfix,
|
||||||
|
@@ -37,7 +37,7 @@ namespace Utils {
|
|||||||
|
|
||||||
namespace Internal { class MacroExpanderPrivate; }
|
namespace Internal { class MacroExpanderPrivate; }
|
||||||
|
|
||||||
class FileName;
|
class FilePath;
|
||||||
class MacroExpander;
|
class MacroExpander;
|
||||||
using MacroExpanderProvider = std::function<MacroExpander *()>;
|
using MacroExpanderProvider = std::function<MacroExpander *()>;
|
||||||
using MacroExpanderProviders = QVector<MacroExpanderProvider>;
|
using MacroExpanderProviders = QVector<MacroExpanderProvider>;
|
||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
QString value(const QByteArray &variable, bool *found = nullptr) const;
|
QString value(const QByteArray &variable, bool *found = nullptr) const;
|
||||||
|
|
||||||
QString expand(const QString &stringWithVariables) const;
|
QString expand(const QString &stringWithVariables) const;
|
||||||
FileName expand(const FileName &fileNameWithVariables) const;
|
FilePath expand(const FilePath &fileNameWithVariables) const;
|
||||||
QByteArray expand(const QByteArray &stringWithVariables) const;
|
QByteArray expand(const QByteArray &stringWithVariables) const;
|
||||||
QVariant expandVariant(const QVariant &v) const;
|
QVariant expandVariant(const QVariant &v) const;
|
||||||
|
|
||||||
|
@@ -193,14 +193,14 @@ QString PathChooserPrivate::expandedPath(const QString &input) const
|
|||||||
if (m_macroExpander)
|
if (m_macroExpander)
|
||||||
expandedInput = m_macroExpander->expand(expandedInput);
|
expandedInput = m_macroExpander->expand(expandedInput);
|
||||||
|
|
||||||
const QString path = FileName::fromUserInput(expandedInput).toString();
|
const QString path = FilePath::fromUserInput(expandedInput).toString();
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
switch (m_acceptingKind) {
|
switch (m_acceptingKind) {
|
||||||
case PathChooser::Command:
|
case PathChooser::Command:
|
||||||
case PathChooser::ExistingCommand: {
|
case PathChooser::ExistingCommand: {
|
||||||
const FileName expanded = m_environment.searchInPath(path, {FileName::fromString(m_baseDirectory)});
|
const FilePath expanded = m_environment.searchInPath(path, {FilePath::fromString(m_baseDirectory)});
|
||||||
return expanded.isEmpty() ? path : expanded.toString();
|
return expanded.isEmpty() ? path : expanded.toString();
|
||||||
}
|
}
|
||||||
case PathChooser::Any:
|
case PathChooser::Any:
|
||||||
@@ -293,12 +293,12 @@ void PathChooser::setBaseDirectory(const QString &directory)
|
|||||||
triggerChanged();
|
triggerChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName PathChooser::baseFileName() const
|
FilePath PathChooser::baseFileName() const
|
||||||
{
|
{
|
||||||
return FileName::fromString(d->m_baseDirectory);
|
return FilePath::fromString(d->m_baseDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathChooser::setBaseFileName(const FileName &base)
|
void PathChooser::setBaseFileName(const FilePath &base)
|
||||||
{
|
{
|
||||||
setBaseDirectory(base.toString());
|
setBaseDirectory(base.toString());
|
||||||
}
|
}
|
||||||
@@ -323,14 +323,14 @@ QString PathChooser::path() const
|
|||||||
return fileName().toString();
|
return fileName().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName PathChooser::rawFileName() const
|
FilePath PathChooser::rawFileName() const
|
||||||
{
|
{
|
||||||
return FileName::fromString(QDir::fromNativeSeparators(d->m_lineEdit->text()));
|
return FilePath::fromString(QDir::fromNativeSeparators(d->m_lineEdit->text()));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName PathChooser::fileName() const
|
FilePath PathChooser::fileName() const
|
||||||
{
|
{
|
||||||
return FileName::fromUserInput(d->expandedPath(rawFileName().toString()));
|
return FilePath::fromUserInput(d->expandedPath(rawFileName().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: try to remove again
|
// FIXME: try to remove again
|
||||||
@@ -352,7 +352,7 @@ void PathChooser::setPath(const QString &path)
|
|||||||
d->m_lineEdit->setTextKeepingActiveCursor(QDir::toNativeSeparators(path));
|
d->m_lineEdit->setTextKeepingActiveCursor(QDir::toNativeSeparators(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathChooser::setFileName(const FileName &fn)
|
void PathChooser::setFileName(const FilePath &fn)
|
||||||
{
|
{
|
||||||
d->m_lineEdit->setTextKeepingActiveCursor(fn.toUserOutput());
|
d->m_lineEdit->setTextKeepingActiveCursor(fn.toUserOutput());
|
||||||
}
|
}
|
||||||
|
@@ -55,8 +55,8 @@ class QTCREATOR_UTILS_EXPORT PathChooser : public QWidget
|
|||||||
Q_PROPERTY(QStringList commandVersionArguments READ commandVersionArguments WRITE setCommandVersionArguments)
|
Q_PROPERTY(QStringList commandVersionArguments READ commandVersionArguments WRITE setCommandVersionArguments)
|
||||||
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true)
|
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true)
|
||||||
// Designer does not know this type, so force designable to false:
|
// Designer does not know this type, so force designable to false:
|
||||||
Q_PROPERTY(Utils::FileName fileName READ fileName WRITE setFileName DESIGNABLE false)
|
Q_PROPERTY(Utils::FilePath fileName READ fileName WRITE setFileName DESIGNABLE false)
|
||||||
Q_PROPERTY(Utils::FileName baseFileName READ baseFileName WRITE setBaseFileName DESIGNABLE false)
|
Q_PROPERTY(Utils::FilePath baseFileName READ baseFileName WRITE setBaseFileName DESIGNABLE false)
|
||||||
Q_PROPERTY(QColor errorColor READ errorColor WRITE setErrorColor DESIGNABLE true)
|
Q_PROPERTY(QColor errorColor READ errorColor WRITE setErrorColor DESIGNABLE true)
|
||||||
Q_PROPERTY(QColor okColor READ okColor WRITE setOkColor DESIGNABLE true)
|
Q_PROPERTY(QColor okColor READ okColor WRITE setOkColor DESIGNABLE true)
|
||||||
|
|
||||||
@@ -93,8 +93,8 @@ public:
|
|||||||
|
|
||||||
QString path() const;
|
QString path() const;
|
||||||
QString rawPath() const; // The raw unexpanded input.
|
QString rawPath() const; // The raw unexpanded input.
|
||||||
FileName rawFileName() const; // The raw unexpanded input.
|
FilePath rawFileName() const; // The raw unexpanded input.
|
||||||
FileName fileName() const;
|
FilePath fileName() const;
|
||||||
|
|
||||||
static QString expandedDirectory(const QString &input, const Environment &env,
|
static QString expandedDirectory(const QString &input, const Environment &env,
|
||||||
const QString &baseDir);
|
const QString &baseDir);
|
||||||
@@ -102,8 +102,8 @@ public:
|
|||||||
QString baseDirectory() const;
|
QString baseDirectory() const;
|
||||||
void setBaseDirectory(const QString &directory);
|
void setBaseDirectory(const QString &directory);
|
||||||
|
|
||||||
FileName baseFileName() const;
|
FilePath baseFileName() const;
|
||||||
void setBaseFileName(const FileName &base);
|
void setBaseFileName(const FilePath &base);
|
||||||
|
|
||||||
void setEnvironment(const Environment &env);
|
void setEnvironment(const Environment &env);
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPath(const QString &);
|
void setPath(const QString &);
|
||||||
void setFileName(const FileName &);
|
void setFileName(const FilePath &);
|
||||||
|
|
||||||
void setErrorColor(const QColor &errorColor);
|
void setErrorColor(const QColor &errorColor);
|
||||||
void setOkColor(const QColor &okColor);
|
void setOkColor(const QColor &okColor);
|
||||||
|
@@ -341,7 +341,7 @@ QVariantMap PersistentSettingsReader::restoreValues() const
|
|||||||
return m_valueMap;
|
return m_valueMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentSettingsReader::load(const FileName &fileName)
|
bool PersistentSettingsReader::load(const FilePath &fileName)
|
||||||
{
|
{
|
||||||
m_valueMap.clear();
|
m_valueMap.clear();
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistentSettingsWriter::PersistentSettingsWriter(const FileName &fileName, const QString &docType) :
|
PersistentSettingsWriter::PersistentSettingsWriter(const FilePath &fileName, const QString &docType) :
|
||||||
m_fileName(fileName), m_docType(docType)
|
m_fileName(fileName), m_docType(docType)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -438,7 +438,7 @@ bool PersistentSettingsWriter::save(const QVariantMap &data, QWidget *parent) co
|
|||||||
}
|
}
|
||||||
#endif // QT_GUI_LIB
|
#endif // QT_GUI_LIB
|
||||||
|
|
||||||
FileName PersistentSettingsWriter::fileName() const
|
FilePath PersistentSettingsWriter::fileName() const
|
||||||
{ return m_fileName; }
|
{ return m_fileName; }
|
||||||
|
|
||||||
//** * @brief Set contents of file (e.g. from data read from it). */
|
//** * @brief Set contents of file (e.g. from data read from it). */
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
PersistentSettingsReader();
|
PersistentSettingsReader();
|
||||||
QVariant restoreValue(const QString &variable, const QVariant &defaultValue = QVariant()) const;
|
QVariant restoreValue(const QString &variable, const QVariant &defaultValue = QVariant()) const;
|
||||||
QVariantMap restoreValues() const;
|
QVariantMap restoreValues() const;
|
||||||
bool load(const FileName &fileName);
|
bool load(const FilePath &fileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, QVariant> m_valueMap;
|
QMap<QString, QVariant> m_valueMap;
|
||||||
@@ -51,7 +51,7 @@ private:
|
|||||||
class QTCREATOR_UTILS_EXPORT PersistentSettingsWriter
|
class QTCREATOR_UTILS_EXPORT PersistentSettingsWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PersistentSettingsWriter(const FileName &fileName, const QString &docType);
|
PersistentSettingsWriter(const FilePath &fileName, const QString &docType);
|
||||||
~PersistentSettingsWriter();
|
~PersistentSettingsWriter();
|
||||||
|
|
||||||
bool save(const QVariantMap &data, QString *errorString) const;
|
bool save(const QVariantMap &data, QString *errorString) const;
|
||||||
@@ -59,14 +59,14 @@ public:
|
|||||||
bool save(const QVariantMap &data, QWidget *parent) const;
|
bool save(const QVariantMap &data, QWidget *parent) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FileName fileName() const;
|
FilePath fileName() const;
|
||||||
|
|
||||||
void setContents(const QVariantMap &data);
|
void setContents(const QVariantMap &data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool write(const QVariantMap &data, QString *errorString) const;
|
bool write(const QVariantMap &data, QString *errorString) const;
|
||||||
|
|
||||||
const FileName m_fileName;
|
const FilePath m_fileName;
|
||||||
const QString m_docType;
|
const QString m_docType;
|
||||||
mutable QMap<QString, QVariant> m_savedData;
|
mutable QMap<QString, QVariant> m_savedData;
|
||||||
};
|
};
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const FileName &fileName,
|
QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const FilePath &fileName,
|
||||||
bool modified,
|
bool modified,
|
||||||
bool enableDiffOption,
|
bool enableDiffOption,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
|
@@ -33,7 +33,7 @@ class QWidget;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class FileName;
|
class FilePath;
|
||||||
|
|
||||||
enum ReloadPromptAnswer {
|
enum ReloadPromptAnswer {
|
||||||
ReloadCurrent,
|
ReloadCurrent,
|
||||||
@@ -44,7 +44,7 @@ enum ReloadPromptAnswer {
|
|||||||
CloseCurrent
|
CloseCurrent
|
||||||
};
|
};
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const FileName &fileName,
|
QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const FilePath &fileName,
|
||||||
bool modified,
|
bool modified,
|
||||||
bool enableDiffOption,
|
bool enableDiffOption,
|
||||||
QWidget *parent);
|
QWidget *parent);
|
||||||
|
@@ -119,7 +119,7 @@ bool SaveFile::commit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString finalFileName
|
QString finalFileName
|
||||||
= FileUtils::resolveSymlinks(FileName::fromString(m_finalFileName)).toString();
|
= FileUtils::resolveSymlinks(FilePath::fromString(m_finalFileName)).toString();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// Release the file lock
|
// Release the file lock
|
||||||
|
@@ -98,7 +98,7 @@ bool SettingsAccessor::saveSettings(const QVariantMap &data, QWidget *parent) co
|
|||||||
/*!
|
/*!
|
||||||
* Read data from \a path. Do all the necessary postprocessing of the data.
|
* Read data from \a path. Do all the necessary postprocessing of the data.
|
||||||
*/
|
*/
|
||||||
SettingsAccessor::RestoreData SettingsAccessor::readData(const FileName &path, QWidget *parent) const
|
SettingsAccessor::RestoreData SettingsAccessor::readData(const FilePath &path, QWidget *parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
RestoreData result = readFile(path);
|
RestoreData result = readFile(path);
|
||||||
@@ -111,13 +111,13 @@ SettingsAccessor::RestoreData SettingsAccessor::readData(const FileName &path, Q
|
|||||||
* Store the \a data in \a path on disk. Do all the necessary preprocessing of the data.
|
* Store the \a data in \a path on disk. Do all the necessary preprocessing of the data.
|
||||||
*/
|
*/
|
||||||
optional<SettingsAccessor::Issue>
|
optional<SettingsAccessor::Issue>
|
||||||
SettingsAccessor::writeData(const FileName &path, const QVariantMap &data, QWidget *parent) const
|
SettingsAccessor::writeData(const FilePath &path, const QVariantMap &data, QWidget *parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
return writeFile(path, prepareToWriteSettings(data));
|
return writeFile(path, prepareToWriteSettings(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap SettingsAccessor::restoreSettings(const FileName &settingsPath, QWidget *parent) const
|
QVariantMap SettingsAccessor::restoreSettings(const FilePath &settingsPath, QWidget *parent) const
|
||||||
{
|
{
|
||||||
const RestoreData result = readData(settingsPath, parent);
|
const RestoreData result = readData(settingsPath, parent);
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ QVariantMap SettingsAccessor::restoreSettings(const FileName &settingsPath, QWid
|
|||||||
*
|
*
|
||||||
* This method does not do *any* processing of the file contents.
|
* This method does not do *any* processing of the file contents.
|
||||||
*/
|
*/
|
||||||
SettingsAccessor::RestoreData SettingsAccessor::readFile(const FileName &path) const
|
SettingsAccessor::RestoreData SettingsAccessor::readFile(const FilePath &path) const
|
||||||
{
|
{
|
||||||
PersistentSettingsReader reader;
|
PersistentSettingsReader reader;
|
||||||
if (!reader.load(path)) {
|
if (!reader.load(path)) {
|
||||||
@@ -156,7 +156,7 @@ SettingsAccessor::RestoreData SettingsAccessor::readFile(const FileName &path) c
|
|||||||
* This method does not do *any* processing of the file contents.
|
* This method does not do *any* processing of the file contents.
|
||||||
*/
|
*/
|
||||||
optional<SettingsAccessor::Issue>
|
optional<SettingsAccessor::Issue>
|
||||||
SettingsAccessor::writeFile(const FileName &path, const QVariantMap &data) const
|
SettingsAccessor::writeFile(const FilePath &path, const QVariantMap &data) const
|
||||||
{
|
{
|
||||||
if (data.isEmpty()) {
|
if (data.isEmpty()) {
|
||||||
return Issue(QCoreApplication::translate("Utils::SettingsAccessor", "Failed to Write File"),
|
return Issue(QCoreApplication::translate("Utils::SettingsAccessor", "Failed to Write File"),
|
||||||
@@ -176,7 +176,7 @@ SettingsAccessor::writeFile(const FileName &path, const QVariantMap &data) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsAccessor::ProceedInfo
|
SettingsAccessor::ProceedInfo
|
||||||
SettingsAccessor::reportIssues(const SettingsAccessor::Issue &issue, const FileName &path,
|
SettingsAccessor::reportIssues(const SettingsAccessor::Issue &issue, const FilePath &path,
|
||||||
QWidget *parent) const
|
QWidget *parent) const
|
||||||
{
|
{
|
||||||
if (!path.exists())
|
if (!path.exists())
|
||||||
@@ -217,14 +217,14 @@ QVariantMap SettingsAccessor::prepareToWriteSettings(const QVariantMap &data) co
|
|||||||
// BackingUpSettingsAccessor:
|
// BackingUpSettingsAccessor:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
FileNameList BackUpStrategy::readFileCandidates(const FileName &baseFileName) const
|
FilePathList BackUpStrategy::readFileCandidates(const FilePath &baseFileName) const
|
||||||
{
|
{
|
||||||
|
|
||||||
const QFileInfo pfi = baseFileName.toFileInfo();
|
const QFileInfo pfi = baseFileName.toFileInfo();
|
||||||
const QStringList filter(pfi.fileName() + '*');
|
const QStringList filter(pfi.fileName() + '*');
|
||||||
const QFileInfoList list = QDir(pfi.dir()).entryInfoList(filter, QDir::Files | QDir::Hidden | QDir::System);
|
const QFileInfoList list = QDir(pfi.dir()).entryInfoList(filter, QDir::Files | QDir::Hidden | QDir::System);
|
||||||
|
|
||||||
return Utils::transform(list, [](const QFileInfo &fi) { return FileName::fromString(fi.absoluteFilePath()); });
|
return Utils::transform(list, [](const QFileInfo &fi) { return FilePath::fromString(fi.absoluteFilePath()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
int BackUpStrategy::compare(const SettingsAccessor::RestoreData &data1,
|
int BackUpStrategy::compare(const SettingsAccessor::RestoreData &data1,
|
||||||
@@ -239,8 +239,8 @@ int BackUpStrategy::compare(const SettingsAccessor::RestoreData &data1,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
optional<FileName>
|
optional<FilePath>
|
||||||
BackUpStrategy::backupName(const QVariantMap &oldData, const FileName &path, const QVariantMap &data) const
|
BackUpStrategy::backupName(const QVariantMap &oldData, const FilePath &path, const QVariantMap &data) const
|
||||||
{
|
{
|
||||||
if (oldData == data)
|
if (oldData == data)
|
||||||
return nullopt;
|
return nullopt;
|
||||||
@@ -262,9 +262,9 @@ BackingUpSettingsAccessor::BackingUpSettingsAccessor(std::unique_ptr<BackUpStrat
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
SettingsAccessor::RestoreData
|
SettingsAccessor::RestoreData
|
||||||
BackingUpSettingsAccessor::readData(const FileName &path, QWidget *parent) const
|
BackingUpSettingsAccessor::readData(const FilePath &path, QWidget *parent) const
|
||||||
{
|
{
|
||||||
const FileNameList fileList = readFileCandidates(path);
|
const FilePathList fileList = readFileCandidates(path);
|
||||||
if (fileList.isEmpty()) // No settings found at all.
|
if (fileList.isEmpty()) // No settings found at all.
|
||||||
return RestoreData(path, QVariantMap());
|
return RestoreData(path, QVariantMap());
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ BackingUpSettingsAccessor::readData(const FileName &path, QWidget *parent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
optional<SettingsAccessor::Issue>
|
optional<SettingsAccessor::Issue>
|
||||||
BackingUpSettingsAccessor::writeData(const FileName &path, const QVariantMap &data,
|
BackingUpSettingsAccessor::writeData(const FilePath &path, const QVariantMap &data,
|
||||||
QWidget *parent) const
|
QWidget *parent) const
|
||||||
{
|
{
|
||||||
if (data.isEmpty())
|
if (data.isEmpty())
|
||||||
@@ -298,9 +298,9 @@ BackingUpSettingsAccessor::writeData(const FileName &path, const QVariantMap &da
|
|||||||
return SettingsAccessor::writeData(path, data, parent);
|
return SettingsAccessor::writeData(path, data, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileNameList BackingUpSettingsAccessor::readFileCandidates(const FileName &path) const
|
FilePathList BackingUpSettingsAccessor::readFileCandidates(const FilePath &path) const
|
||||||
{
|
{
|
||||||
FileNameList result = Utils::filteredUnique(m_strategy->readFileCandidates(path));
|
FilePathList result = Utils::filteredUnique(m_strategy->readFileCandidates(path));
|
||||||
if (result.removeOne(baseFilePath()))
|
if (result.removeOne(baseFilePath()))
|
||||||
result.prepend(baseFilePath());
|
result.prepend(baseFilePath());
|
||||||
|
|
||||||
@@ -308,10 +308,10 @@ FileNameList BackingUpSettingsAccessor::readFileCandidates(const FileName &path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsAccessor::RestoreData
|
SettingsAccessor::RestoreData
|
||||||
BackingUpSettingsAccessor::bestReadFileData(const FileNameList &candidates, QWidget *parent) const
|
BackingUpSettingsAccessor::bestReadFileData(const FilePathList &candidates, QWidget *parent) const
|
||||||
{
|
{
|
||||||
SettingsAccessor::RestoreData bestMatch;
|
SettingsAccessor::RestoreData bestMatch;
|
||||||
for (const FileName &c : candidates) {
|
for (const FilePath &c : candidates) {
|
||||||
RestoreData cData = SettingsAccessor::readData(c, parent);
|
RestoreData cData = SettingsAccessor::readData(c, parent);
|
||||||
if (m_strategy->compare(bestMatch, cData) > 0)
|
if (m_strategy->compare(bestMatch, cData) > 0)
|
||||||
bestMatch = cData;
|
bestMatch = cData;
|
||||||
@@ -319,7 +319,7 @@ BackingUpSettingsAccessor::bestReadFileData(const FileNameList &candidates, QWid
|
|||||||
return bestMatch;
|
return bestMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackingUpSettingsAccessor::backupFile(const FileName &path, const QVariantMap &data,
|
void BackingUpSettingsAccessor::backupFile(const FilePath &path, const QVariantMap &data,
|
||||||
QWidget *parent) const
|
QWidget *parent) const
|
||||||
{
|
{
|
||||||
RestoreData oldSettings = SettingsAccessor::readData(path, parent);
|
RestoreData oldSettings = SettingsAccessor::readData(path, parent);
|
||||||
@@ -328,7 +328,7 @@ void BackingUpSettingsAccessor::backupFile(const FileName &path, const QVariantM
|
|||||||
|
|
||||||
// Do we need to do a backup?
|
// Do we need to do a backup?
|
||||||
const QString origName = path.toString();
|
const QString origName = path.toString();
|
||||||
optional<FileName> backupFileName = m_strategy->backupName(oldSettings.data, path, data);
|
optional<FilePath> backupFileName = m_strategy->backupName(oldSettings.data, path, data);
|
||||||
if (backupFileName)
|
if (backupFileName)
|
||||||
QFile::copy(origName, backupFileName.value().toString());
|
QFile::copy(origName, backupFileName.value().toString());
|
||||||
}
|
}
|
||||||
@@ -359,11 +359,11 @@ int VersionedBackUpStrategy::compare(const SettingsAccessor::RestoreData &data1,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
optional<FileName>
|
optional<FilePath>
|
||||||
VersionedBackUpStrategy::backupName(const QVariantMap &oldData, const FileName &path, const QVariantMap &data) const
|
VersionedBackUpStrategy::backupName(const QVariantMap &oldData, const FilePath &path, const QVariantMap &data) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(data);
|
Q_UNUSED(data);
|
||||||
FileName backupName = path;
|
FilePath backupName = path;
|
||||||
const QByteArray oldEnvironmentId = settingsIdFromMap(oldData);
|
const QByteArray oldEnvironmentId = settingsIdFromMap(oldData);
|
||||||
const int oldVersion = versionFromMap(oldData);
|
const int oldVersion = versionFromMap(oldData);
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ bool UpgradingSettingsAccessor::isValidVersionAndId(const int version, const QBy
|
|||||||
&& (id.isEmpty() || id == m_id || m_id.isEmpty());
|
&& (id.isEmpty() || id == m_id || m_id.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsAccessor::RestoreData UpgradingSettingsAccessor::readData(const FileName &path,
|
SettingsAccessor::RestoreData UpgradingSettingsAccessor::readData(const FilePath &path,
|
||||||
QWidget *parent) const
|
QWidget *parent) const
|
||||||
{
|
{
|
||||||
return upgradeSettings(BackingUpSettingsAccessor::readData(path, parent), currentVersion());
|
return upgradeSettings(BackingUpSettingsAccessor::readData(path, parent), currentVersion());
|
||||||
@@ -605,7 +605,7 @@ MergingSettingsAccessor::MergingSettingsAccessor(std::unique_ptr<BackUpStrategy>
|
|||||||
UpgradingSettingsAccessor(std::move(strategy), docType, displayName, applicationDisplayName)
|
UpgradingSettingsAccessor(std::move(strategy), docType, displayName, applicationDisplayName)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
SettingsAccessor::RestoreData MergingSettingsAccessor::readData(const FileName &path,
|
SettingsAccessor::RestoreData MergingSettingsAccessor::readData(const FilePath &path,
|
||||||
QWidget *parent) const
|
QWidget *parent) const
|
||||||
{
|
{
|
||||||
RestoreData mainData = UpgradingSettingsAccessor::readData(path, parent); // FULLY upgraded!
|
RestoreData mainData = UpgradingSettingsAccessor::readData(path, parent); // FULLY upgraded!
|
||||||
|
@@ -99,7 +99,7 @@ public:
|
|||||||
class RestoreData {
|
class RestoreData {
|
||||||
public:
|
public:
|
||||||
RestoreData() = default;
|
RestoreData() = default;
|
||||||
RestoreData(const FileName &path, const QVariantMap &data) : path{path}, data{data} { }
|
RestoreData(const FilePath &path, const QVariantMap &data) : path{path}, data{data} { }
|
||||||
RestoreData(const QString &title, const QString &message, const Issue::Type type) :
|
RestoreData(const QString &title, const QString &message, const Issue::Type type) :
|
||||||
RestoreData(Issue(title, message, type))
|
RestoreData(Issue(title, message, type))
|
||||||
{ }
|
{ }
|
||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
bool hasError() const { return hasIssue() && issue.value().type == Issue::Type::ERROR; }
|
bool hasError() const { return hasIssue() && issue.value().type == Issue::Type::ERROR; }
|
||||||
bool hasWarning() const { return hasIssue() && issue.value().type == Issue::Type::WARNING; }
|
bool hasWarning() const { return hasIssue() && issue.value().type == Issue::Type::WARNING; }
|
||||||
|
|
||||||
FileName path;
|
FilePath path;
|
||||||
QVariantMap data;
|
QVariantMap data;
|
||||||
optional<Issue> issue;
|
optional<Issue> issue;
|
||||||
};
|
};
|
||||||
@@ -121,26 +121,26 @@ public:
|
|||||||
const QString displayName;
|
const QString displayName;
|
||||||
const QString applicationDisplayName;
|
const QString applicationDisplayName;
|
||||||
|
|
||||||
void setBaseFilePath(const FileName &baseFilePath) { m_baseFilePath = baseFilePath; }
|
void setBaseFilePath(const FilePath &baseFilePath) { m_baseFilePath = baseFilePath; }
|
||||||
void setReadOnly() { m_readOnly = true; }
|
void setReadOnly() { m_readOnly = true; }
|
||||||
FileName baseFilePath() const { return m_baseFilePath; }
|
FilePath baseFilePath() const { return m_baseFilePath; }
|
||||||
|
|
||||||
virtual RestoreData readData(const FileName &path, QWidget *parent) const;
|
virtual RestoreData readData(const FilePath &path, QWidget *parent) const;
|
||||||
virtual optional<Issue> writeData(const FileName &path, const QVariantMap &data, QWidget *parent) const;
|
virtual optional<Issue> writeData(const FilePath &path, const QVariantMap &data, QWidget *parent) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Report errors:
|
// Report errors:
|
||||||
QVariantMap restoreSettings(const FileName &settingsPath, QWidget *parent) const;
|
QVariantMap restoreSettings(const FilePath &settingsPath, QWidget *parent) const;
|
||||||
ProceedInfo reportIssues(const Issue &issue, const FileName &path, QWidget *parent) const;
|
ProceedInfo reportIssues(const Issue &issue, const FilePath &path, QWidget *parent) const;
|
||||||
|
|
||||||
virtual QVariantMap preprocessReadSettings(const QVariantMap &data) const;
|
virtual QVariantMap preprocessReadSettings(const QVariantMap &data) const;
|
||||||
virtual QVariantMap prepareToWriteSettings(const QVariantMap &data) const;
|
virtual QVariantMap prepareToWriteSettings(const QVariantMap &data) const;
|
||||||
|
|
||||||
virtual RestoreData readFile(const FileName &path) const;
|
virtual RestoreData readFile(const FilePath &path) const;
|
||||||
virtual optional<Issue> writeFile(const FileName &path, const QVariantMap &data) const;
|
virtual optional<Issue> writeFile(const FilePath &path, const QVariantMap &data) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FileName m_baseFilePath;
|
FilePath m_baseFilePath;
|
||||||
mutable std::unique_ptr<PersistentSettingsWriter> m_writer;
|
mutable std::unique_ptr<PersistentSettingsWriter> m_writer;
|
||||||
bool m_readOnly = false;
|
bool m_readOnly = false;
|
||||||
};
|
};
|
||||||
@@ -154,14 +154,14 @@ class QTCREATOR_UTILS_EXPORT BackUpStrategy
|
|||||||
public:
|
public:
|
||||||
virtual ~BackUpStrategy() = default;
|
virtual ~BackUpStrategy() = default;
|
||||||
|
|
||||||
virtual FileNameList readFileCandidates(const FileName &baseFileName) const;
|
virtual FilePathList readFileCandidates(const FilePath &baseFileName) const;
|
||||||
// Return -1 if data1 is better that data2, 0 if both are equally worthwhile
|
// Return -1 if data1 is better that data2, 0 if both are equally worthwhile
|
||||||
// and 1 if data2 is better than data1
|
// and 1 if data2 is better than data1
|
||||||
virtual int compare(const SettingsAccessor::RestoreData &data1,
|
virtual int compare(const SettingsAccessor::RestoreData &data1,
|
||||||
const SettingsAccessor::RestoreData &data2) const;
|
const SettingsAccessor::RestoreData &data2) const;
|
||||||
|
|
||||||
virtual optional<FileName>
|
virtual optional<FilePath>
|
||||||
backupName(const QVariantMap &oldData, const FileName &path, const QVariantMap &data) const;
|
backupName(const QVariantMap &oldData, const FilePath &path, const QVariantMap &data) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT BackingUpSettingsAccessor : public SettingsAccessor
|
class QTCREATOR_UTILS_EXPORT BackingUpSettingsAccessor : public SettingsAccessor
|
||||||
@@ -172,16 +172,16 @@ public:
|
|||||||
BackingUpSettingsAccessor(std::unique_ptr<BackUpStrategy> &&strategy, const QString &docType,
|
BackingUpSettingsAccessor(std::unique_ptr<BackUpStrategy> &&strategy, const QString &docType,
|
||||||
const QString &displayName, const QString &applicationDisplayName);
|
const QString &displayName, const QString &applicationDisplayName);
|
||||||
|
|
||||||
RestoreData readData(const FileName &path, QWidget *parent) const override;
|
RestoreData readData(const FilePath &path, QWidget *parent) const override;
|
||||||
optional<Issue> writeData(const FileName &path, const QVariantMap &data,
|
optional<Issue> writeData(const FilePath &path, const QVariantMap &data,
|
||||||
QWidget *parent) const override;
|
QWidget *parent) const override;
|
||||||
|
|
||||||
BackUpStrategy *strategy() const { return m_strategy.get(); }
|
BackUpStrategy *strategy() const { return m_strategy.get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FileNameList readFileCandidates(const FileName &path) const;
|
FilePathList readFileCandidates(const FilePath &path) const;
|
||||||
RestoreData bestReadFileData(const FileNameList &candidates, QWidget *parent) const;
|
RestoreData bestReadFileData(const FilePathList &candidates, QWidget *parent) const;
|
||||||
void backupFile(const FileName &path, const QVariantMap &data, QWidget *parent) const;
|
void backupFile(const FilePath &path, const QVariantMap &data, QWidget *parent) const;
|
||||||
|
|
||||||
std::unique_ptr<BackUpStrategy> m_strategy;
|
std::unique_ptr<BackUpStrategy> m_strategy;
|
||||||
};
|
};
|
||||||
@@ -202,8 +202,8 @@ public:
|
|||||||
int compare(const SettingsAccessor::RestoreData &data1,
|
int compare(const SettingsAccessor::RestoreData &data1,
|
||||||
const SettingsAccessor::RestoreData &data2) const override;
|
const SettingsAccessor::RestoreData &data2) const override;
|
||||||
|
|
||||||
optional<FileName>
|
optional<FilePath>
|
||||||
backupName(const QVariantMap &oldData, const FileName &path, const QVariantMap &data) const override;
|
backupName(const QVariantMap &oldData, const FilePath &path, const QVariantMap &data) const override;
|
||||||
|
|
||||||
const UpgradingSettingsAccessor *accessor() const { return m_accessor; }
|
const UpgradingSettingsAccessor *accessor() const { return m_accessor; }
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ public:
|
|||||||
bool isValidVersionAndId(const int version, const QByteArray &id) const;
|
bool isValidVersionAndId(const int version, const QByteArray &id) const;
|
||||||
VersionUpgrader *upgrader(const int version) const;
|
VersionUpgrader *upgrader(const int version) const;
|
||||||
|
|
||||||
RestoreData readData(const FileName &path, QWidget *parent) const override;
|
RestoreData readData(const FilePath &path, QWidget *parent) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVariantMap prepareToWriteSettings(const QVariantMap &data) const override;
|
QVariantMap prepareToWriteSettings(const QVariantMap &data) const override;
|
||||||
@@ -284,7 +284,7 @@ public:
|
|||||||
const QString &docType, const QString &displayName,
|
const QString &docType, const QString &displayName,
|
||||||
const QString &applicationDisplayName);
|
const QString &applicationDisplayName);
|
||||||
|
|
||||||
RestoreData readData(const FileName &path, QWidget *parent) const final;
|
RestoreData readData(const FilePath &path, QWidget *parent) const final;
|
||||||
|
|
||||||
void setSecondaryAccessor(std::unique_ptr<SettingsAccessor> &&secondary);
|
void setSecondaryAccessor(std::unique_ptr<SettingsAccessor> &&secondary);
|
||||||
|
|
||||||
|
@@ -68,11 +68,11 @@ class ShellCommandPrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct Job {
|
struct Job {
|
||||||
explicit Job(const QString &wd, const FileName &b, const QStringList &a, int t,
|
explicit Job(const QString &wd, const FilePath &b, const QStringList &a, int t,
|
||||||
const ExitCodeInterpreter &interpreter);
|
const ExitCodeInterpreter &interpreter);
|
||||||
|
|
||||||
QString workingDirectory;
|
QString workingDirectory;
|
||||||
FileName binary;
|
FilePath binary;
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
ExitCodeInterpreter exitCodeInterpreter;
|
ExitCodeInterpreter exitCodeInterpreter;
|
||||||
int timeoutS;
|
int timeoutS;
|
||||||
@@ -113,7 +113,7 @@ ShellCommandPrivate::~ShellCommandPrivate()
|
|||||||
delete m_progressParser;
|
delete m_progressParser;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellCommandPrivate::Job::Job(const QString &wd, const FileName &b, const QStringList &a,
|
ShellCommandPrivate::Job::Job(const QString &wd, const FilePath &b, const QStringList &a,
|
||||||
int t, const ExitCodeInterpreter &interpreter) :
|
int t, const ExitCodeInterpreter &interpreter) :
|
||||||
workingDirectory(wd),
|
workingDirectory(wd),
|
||||||
binary(b),
|
binary(b),
|
||||||
@@ -195,13 +195,13 @@ void ShellCommand::addFlags(unsigned f)
|
|||||||
d->m_flags |= f;
|
d->m_flags |= f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellCommand::addJob(const FileName &binary, const QStringList &arguments,
|
void ShellCommand::addJob(const FilePath &binary, const QStringList &arguments,
|
||||||
const QString &workingDirectory, const ExitCodeInterpreter &interpreter)
|
const QString &workingDirectory, const ExitCodeInterpreter &interpreter)
|
||||||
{
|
{
|
||||||
addJob(binary, arguments, defaultTimeoutS(), workingDirectory, interpreter);
|
addJob(binary, arguments, defaultTimeoutS(), workingDirectory, interpreter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellCommand::addJob(const FileName &binary, const QStringList &arguments, int timeoutS,
|
void ShellCommand::addJob(const FilePath &binary, const QStringList &arguments, int timeoutS,
|
||||||
const QString &workingDirectory, const ExitCodeInterpreter &interpreter)
|
const QString &workingDirectory, const ExitCodeInterpreter &interpreter)
|
||||||
{
|
{
|
||||||
d->m_jobs.push_back(Internal::ShellCommandPrivate::Job(workDirectory(workingDirectory), binary,
|
d->m_jobs.push_back(Internal::ShellCommandPrivate::Job(workDirectory(workingDirectory), binary,
|
||||||
@@ -319,7 +319,7 @@ void ShellCommand::run(QFutureInterface<void> &future)
|
|||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
SynchronousProcessResponse ShellCommand::runCommand(const FileName &binary,
|
SynchronousProcessResponse ShellCommand::runCommand(const FilePath &binary,
|
||||||
const QStringList &arguments, int timeoutS,
|
const QStringList &arguments, int timeoutS,
|
||||||
const QString &workingDirectory,
|
const QString &workingDirectory,
|
||||||
const ExitCodeInterpreter &interpreter)
|
const ExitCodeInterpreter &interpreter)
|
||||||
@@ -359,7 +359,7 @@ SynchronousProcessResponse ShellCommand::runCommand(const FileName &binary,
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynchronousProcessResponse ShellCommand::runFullySynchronous(const FileName &binary,
|
SynchronousProcessResponse ShellCommand::runFullySynchronous(const FilePath &binary,
|
||||||
const QStringList &arguments,
|
const QStringList &arguments,
|
||||||
QSharedPointer<OutputProxy> proxy,
|
QSharedPointer<OutputProxy> proxy,
|
||||||
int timeoutS,
|
int timeoutS,
|
||||||
@@ -399,7 +399,7 @@ SynchronousProcessResponse ShellCommand::runFullySynchronous(const FileName &bin
|
|||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary,
|
SynchronousProcessResponse ShellCommand::runSynchronous(const FilePath &binary,
|
||||||
const QStringList &arguments,
|
const QStringList &arguments,
|
||||||
QSharedPointer<OutputProxy> proxy,
|
QSharedPointer<OutputProxy> proxy,
|
||||||
int timeoutS,
|
int timeoutS,
|
||||||
|
@@ -46,7 +46,7 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
class FileName;
|
class FilePath;
|
||||||
namespace Internal { class ShellCommandPrivate; }
|
namespace Internal { class ShellCommandPrivate; }
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT ProgressParser
|
class QTCREATOR_UTILS_EXPORT ProgressParser
|
||||||
@@ -79,7 +79,7 @@ signals:
|
|||||||
void append(const QString &text);
|
void append(const QString &text);
|
||||||
void appendSilently(const QString &text);
|
void appendSilently(const QString &text);
|
||||||
void appendError(const QString &text);
|
void appendError(const QString &text);
|
||||||
void appendCommand(const QString &workingDirectory, const Utils::FileName &binary,
|
void appendCommand(const QString &workingDirectory, const Utils::FilePath &binary,
|
||||||
const QStringList &args);
|
const QStringList &args);
|
||||||
void appendMessage(const QString &text);
|
void appendMessage(const QString &text);
|
||||||
};
|
};
|
||||||
@@ -112,9 +112,9 @@ public:
|
|||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
void setDisplayName(const QString &name);
|
void setDisplayName(const QString &name);
|
||||||
|
|
||||||
void addJob(const FileName &binary, const QStringList &arguments,
|
void addJob(const FilePath &binary, const QStringList &arguments,
|
||||||
const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
||||||
void addJob(const FileName &binary, const QStringList &arguments, int timeoutS,
|
void addJob(const FilePath &binary, const QStringList &arguments, int timeoutS,
|
||||||
const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
||||||
void execute(); // Execute tasks asynchronously!
|
void execute(); // Execute tasks asynchronously!
|
||||||
void abort();
|
void abort();
|
||||||
@@ -145,7 +145,7 @@ public:
|
|||||||
// This is called once per job in a thread.
|
// This is called once per job in a thread.
|
||||||
// When called from the UI thread it will execute fully synchronously, so no signals will
|
// When called from the UI thread it will execute fully synchronously, so no signals will
|
||||||
// be triggered!
|
// be triggered!
|
||||||
virtual SynchronousProcessResponse runCommand(const FileName &binary, const QStringList &arguments,
|
virtual SynchronousProcessResponse runCommand(const FilePath &binary, const QStringList &arguments,
|
||||||
int timeoutS,
|
int timeoutS,
|
||||||
const QString &workingDirectory = QString(),
|
const QString &workingDirectory = QString(),
|
||||||
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
||||||
@@ -171,12 +171,12 @@ private:
|
|||||||
void run(QFutureInterface<void> &future);
|
void run(QFutureInterface<void> &future);
|
||||||
|
|
||||||
// Run without a event loop in fully blocking mode. No signals will be delivered.
|
// Run without a event loop in fully blocking mode. No signals will be delivered.
|
||||||
SynchronousProcessResponse runFullySynchronous(const FileName &binary, const QStringList &arguments,
|
SynchronousProcessResponse runFullySynchronous(const FilePath &binary, const QStringList &arguments,
|
||||||
QSharedPointer<OutputProxy> proxy,
|
QSharedPointer<OutputProxy> proxy,
|
||||||
int timeoutS, const QString &workingDirectory,
|
int timeoutS, const QString &workingDirectory,
|
||||||
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
||||||
// Run with an event loop. Signals will be delivered.
|
// Run with an event loop. Signals will be delivered.
|
||||||
SynchronousProcessResponse runSynchronous(const FileName &binary, const QStringList &arguments,
|
SynchronousProcessResponse runSynchronous(const FilePath &binary, const QStringList &arguments,
|
||||||
QSharedPointer<OutputProxy> proxy,
|
QSharedPointer<OutputProxy> proxy,
|
||||||
int timeoutS, const QString &workingDirectory,
|
int timeoutS, const QString &workingDirectory,
|
||||||
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
|
||||||
|
@@ -77,7 +77,7 @@ QString UnixUtils::substituteFileBrowserParameters(const QString &pre, const QSt
|
|||||||
} else if (c == QLatin1Char('f')) {
|
} else if (c == QLatin1Char('f')) {
|
||||||
s = QLatin1Char('"') + file + QLatin1Char('"');
|
s = QLatin1Char('"') + file + QLatin1Char('"');
|
||||||
} else if (c == QLatin1Char('n')) {
|
} else if (c == QLatin1Char('n')) {
|
||||||
s = QLatin1Char('"') + FileName::fromString(file).fileName() + QLatin1Char('"');
|
s = QLatin1Char('"') + FilePath::fromString(file).fileName() + QLatin1Char('"');
|
||||||
} else if (c == QLatin1Char('%')) {
|
} else if (c == QLatin1Char('%')) {
|
||||||
s = c;
|
s = c;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -429,11 +429,11 @@ bool AvdManagerOutputParser::parseAvd(const QStringList &deviceInfo, AndroidDevi
|
|||||||
} else if (valueForKey(avdInfoNameKey, line, &value)) {
|
} else if (valueForKey(avdInfoNameKey, line, &value)) {
|
||||||
avd->avdname = value;
|
avd->avdname = value;
|
||||||
} else if (valueForKey(avdInfoPathKey, line, &value)) {
|
} else if (valueForKey(avdInfoPathKey, line, &value)) {
|
||||||
const Utils::FileName avdPath = Utils::FileName::fromString(value);
|
const Utils::FilePath avdPath = Utils::FilePath::fromString(value);
|
||||||
if (avdPath.exists())
|
if (avdPath.exists())
|
||||||
{
|
{
|
||||||
// Get ABI.
|
// Get ABI.
|
||||||
const Utils::FileName configFile = avdPath.pathAppended("config.ini");
|
const Utils::FilePath configFile = avdPath.pathAppended("config.ini");
|
||||||
QSettings config(configFile.toString(), QSettings::IniFormat);
|
QSettings config(configFile.toString(), QSettings::IniFormat);
|
||||||
value = config.value(avdInfoAbiKey).toString();
|
value = config.value(avdInfoAbiKey).toString();
|
||||||
if (!value.isEmpty())
|
if (!value.isEmpty())
|
||||||
@@ -443,7 +443,7 @@ bool AvdManagerOutputParser::parseAvd(const QStringList &deviceInfo, AndroidDevi
|
|||||||
|
|
||||||
// Get Target
|
// Get Target
|
||||||
QString avdInfoFileName = avdPath.toFileInfo().baseName() + ".ini";
|
QString avdInfoFileName = avdPath.toFileInfo().baseName() + ".ini";
|
||||||
const Utils::FileName
|
const Utils::FilePath
|
||||||
avdInfoFile = avdPath.parentDir().pathAppended(avdInfoFileName);
|
avdInfoFile = avdPath.parentDir().pathAppended(avdInfoFileName);
|
||||||
QSettings avdInfo(avdInfoFile.toString(), QSettings::IniFormat);
|
QSettings avdInfo(avdInfoFile.toString(), QSettings::IniFormat);
|
||||||
value = avdInfo.value(avdInfoTargetKey).toString();
|
value = avdInfo.value(avdInfoTargetKey).toString();
|
||||||
|
@@ -94,7 +94,7 @@ static void setupProcessParameters(ProcessParameters *pp,
|
|||||||
pp->setWorkingDirectory(bc->buildDirectory());
|
pp->setWorkingDirectory(bc->buildDirectory());
|
||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
pp->setEnvironment(env);
|
pp->setEnvironment(env);
|
||||||
pp->setCommand(FileName::fromString(command));
|
pp->setCommand(FilePath::fromString(command));
|
||||||
pp->setArguments(Utils::QtcProcess::joinArgs(arguments));
|
pp->setArguments(Utils::QtcProcess::joinArgs(arguments));
|
||||||
pp->resolveAll();
|
pp->resolveAll();
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ bool AndroidBuildApkStep::init()
|
|||||||
|
|
||||||
auto parser = new JavaParser;
|
auto parser = new JavaParser;
|
||||||
parser->setProjectFileList(Utils::transform(target()->project()->files(ProjectExplorer::Project::AllFiles),
|
parser->setProjectFileList(Utils::transform(target()->project()->files(ProjectExplorer::Project::AllFiles),
|
||||||
&Utils::FileName::toString));
|
&Utils::FilePath::toString));
|
||||||
|
|
||||||
RunConfiguration *rc = target()->activeRunConfiguration();
|
RunConfiguration *rc = target()->activeRunConfiguration();
|
||||||
const QString buildKey = rc ? rc->buildKey() : QString();
|
const QString buildKey = rc ? rc->buildKey() : QString();
|
||||||
@@ -202,7 +202,7 @@ bool AndroidBuildApkStep::init()
|
|||||||
sourceDirName = node->data(Constants::AndroidPackageSourceDir).toString();
|
sourceDirName = node->data(Constants::AndroidPackageSourceDir).toString();
|
||||||
|
|
||||||
QFileInfo sourceDirInfo(sourceDirName);
|
QFileInfo sourceDirInfo(sourceDirName);
|
||||||
parser->setSourceDirectory(Utils::FileName::fromString(sourceDirInfo.canonicalFilePath()));
|
parser->setSourceDirectory(Utils::FilePath::fromString(sourceDirInfo.canonicalFilePath()));
|
||||||
parser->setBuildDirectory(bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY));
|
parser->setBuildDirectory(bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY));
|
||||||
setOutputParser(parser);
|
setOutputParser(parser);
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ void AndroidBuildApkStep::doRun()
|
|||||||
|
|
||||||
auto setup = [this] {
|
auto setup = [this] {
|
||||||
auto bc = target()->activeBuildConfiguration();
|
auto bc = target()->activeBuildConfiguration();
|
||||||
Utils::FileName androidLibsDir = bc->buildDirectory()
|
Utils::FilePath androidLibsDir = bc->buildDirectory()
|
||||||
.pathAppended("android-build/libs")
|
.pathAppended("android-build/libs")
|
||||||
.pathAppended(AndroidManager::targetArch(target()));
|
.pathAppended(AndroidManager::targetArch(target()));
|
||||||
if (!androidLibsDir.exists() && !QDir{bc->buildDirectory().toString()}.mkpath(androidLibsDir.toString()))
|
if (!androidLibsDir.exists() && !QDir{bc->buildDirectory().toString()}.mkpath(androidLibsDir.toString()))
|
||||||
@@ -443,7 +443,7 @@ void AndroidBuildApkStep::processStarted()
|
|||||||
|
|
||||||
bool AndroidBuildApkStep::fromMap(const QVariantMap &map)
|
bool AndroidBuildApkStep::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
m_keystorePath = Utils::FileName::fromString(map.value(KeystoreLocationKey).toString());
|
m_keystorePath = Utils::FilePath::fromString(map.value(KeystoreLocationKey).toString());
|
||||||
m_signPackage = false; // don't restore this
|
m_signPackage = false; // don't restore this
|
||||||
m_buildTargetSdk = map.value(BuildTargetSdkKey).toString();
|
m_buildTargetSdk = map.value(BuildTargetSdkKey).toString();
|
||||||
if (m_buildTargetSdk.isEmpty()) {
|
if (m_buildTargetSdk.isEmpty()) {
|
||||||
@@ -465,7 +465,7 @@ QVariantMap AndroidBuildApkStep::toMap() const
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName AndroidBuildApkStep::keystorePath()
|
Utils::FilePath AndroidBuildApkStep::keystorePath()
|
||||||
{
|
{
|
||||||
return m_keystorePath;
|
return m_keystorePath;
|
||||||
}
|
}
|
||||||
@@ -493,7 +493,7 @@ QVariant AndroidBuildApkStep::data(Core::Id id) const
|
|||||||
return AbstractProcessStep::data(id);
|
return AbstractProcessStep::data(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidBuildApkStep::setKeystorePath(const Utils::FileName &path)
|
void AndroidBuildApkStep::setKeystorePath(const Utils::FilePath &path)
|
||||||
{
|
{
|
||||||
m_keystorePath = path;
|
m_keystorePath = path;
|
||||||
m_certificatePasswd.clear();
|
m_certificatePasswd.clear();
|
||||||
|
@@ -51,8 +51,8 @@ public:
|
|||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
// signing
|
// signing
|
||||||
Utils::FileName keystorePath();
|
Utils::FilePath keystorePath();
|
||||||
void setKeystorePath(const Utils::FileName &path);
|
void setKeystorePath(const Utils::FilePath &path);
|
||||||
void setKeystorePassword(const QString &pwd);
|
void setKeystorePassword(const QString &pwd);
|
||||||
void setCertificateAlias(const QString &alias);
|
void setCertificateAlias(const QString &alias);
|
||||||
void setCertificatePassword(const QString &pwd);
|
void setCertificatePassword(const QString &pwd);
|
||||||
@@ -97,7 +97,7 @@ private:
|
|||||||
bool m_addDebugger = true;
|
bool m_addDebugger = true;
|
||||||
QString m_buildTargetSdk;
|
QString m_buildTargetSdk;
|
||||||
|
|
||||||
Utils::FileName m_keystorePath;
|
Utils::FilePath m_keystorePath;
|
||||||
QString m_keystorePasswd;
|
QString m_keystorePasswd;
|
||||||
QString m_certificateAlias;
|
QString m_certificateAlias;
|
||||||
QString m_certificatePasswd;
|
QString m_certificatePasswd;
|
||||||
|
@@ -132,7 +132,7 @@ QWidget *AndroidBuildApkWidget::createSignPackageGroup()
|
|||||||
keystoreLocationChooser->setPromptDialogFilter(tr("Keystore files (*.keystore *.jks)"));
|
keystoreLocationChooser->setPromptDialogFilter(tr("Keystore files (*.keystore *.jks)"));
|
||||||
keystoreLocationChooser->setPromptDialogTitle(tr("Select Keystore File"));
|
keystoreLocationChooser->setPromptDialogTitle(tr("Select Keystore File"));
|
||||||
connect(keystoreLocationChooser, &PathChooser::pathChanged, this, [this](const QString &path) {
|
connect(keystoreLocationChooser, &PathChooser::pathChanged, this, [this](const QString &path) {
|
||||||
FileName file = FileName::fromString(path);
|
FilePath file = FilePath::fromString(path);
|
||||||
m_step->setKeystorePath(file);
|
m_step->setKeystorePath(file);
|
||||||
m_signPackageCheckBox->setChecked(!file.isEmpty());
|
m_signPackageCheckBox->setChecked(!file.isEmpty());
|
||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
|
@@ -225,23 +225,23 @@ void AndroidConfig::load(const QSettings &settings)
|
|||||||
{
|
{
|
||||||
// user settings
|
// user settings
|
||||||
m_partitionSize = settings.value(PartitionSizeKey, 1024).toInt();
|
m_partitionSize = settings.value(PartitionSizeKey, 1024).toInt();
|
||||||
m_sdkLocation = FileName::fromString(settings.value(SDKLocationKey).toString());
|
m_sdkLocation = FilePath::fromString(settings.value(SDKLocationKey).toString());
|
||||||
m_sdkManagerToolArgs = settings.value(SDKManagerToolArgsKey).toStringList();
|
m_sdkManagerToolArgs = settings.value(SDKManagerToolArgsKey).toStringList();
|
||||||
m_ndkLocation = FileName::fromString(settings.value(NDKLocationKey).toString());
|
m_ndkLocation = FilePath::fromString(settings.value(NDKLocationKey).toString());
|
||||||
m_openJDKLocation = FileName::fromString(settings.value(OpenJDKLocationKey).toString());
|
m_openJDKLocation = FilePath::fromString(settings.value(OpenJDKLocationKey).toString());
|
||||||
m_keystoreLocation = FileName::fromString(settings.value(KeystoreLocationKey).toString());
|
m_keystoreLocation = FilePath::fromString(settings.value(KeystoreLocationKey).toString());
|
||||||
m_toolchainHost = settings.value(ToolchainHostKey).toString();
|
m_toolchainHost = settings.value(ToolchainHostKey).toString();
|
||||||
m_automaticKitCreation = settings.value(AutomaticKitCreationKey, true).toBool();
|
m_automaticKitCreation = settings.value(AutomaticKitCreationKey, true).toBool();
|
||||||
|
|
||||||
PersistentSettingsReader reader;
|
PersistentSettingsReader reader;
|
||||||
if (reader.load(FileName::fromString(sdkSettingsFileName()))
|
if (reader.load(FilePath::fromString(sdkSettingsFileName()))
|
||||||
&& settings.value(changeTimeStamp).toInt() != QFileInfo(sdkSettingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) {
|
&& settings.value(changeTimeStamp).toInt() != QFileInfo(sdkSettingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) {
|
||||||
// persisten settings
|
// persisten settings
|
||||||
m_sdkLocation = FileName::fromString(reader.restoreValue(SDKLocationKey, m_sdkLocation.toString()).toString());
|
m_sdkLocation = FilePath::fromString(reader.restoreValue(SDKLocationKey, m_sdkLocation.toString()).toString());
|
||||||
m_sdkManagerToolArgs = reader.restoreValue(SDKManagerToolArgsKey, m_sdkManagerToolArgs).toStringList();
|
m_sdkManagerToolArgs = reader.restoreValue(SDKManagerToolArgsKey, m_sdkManagerToolArgs).toStringList();
|
||||||
m_ndkLocation = FileName::fromString(reader.restoreValue(NDKLocationKey, m_ndkLocation.toString()).toString());
|
m_ndkLocation = FilePath::fromString(reader.restoreValue(NDKLocationKey, m_ndkLocation.toString()).toString());
|
||||||
m_openJDKLocation = FileName::fromString(reader.restoreValue(OpenJDKLocationKey, m_openJDKLocation.toString()).toString());
|
m_openJDKLocation = FilePath::fromString(reader.restoreValue(OpenJDKLocationKey, m_openJDKLocation.toString()).toString());
|
||||||
m_keystoreLocation = FileName::fromString(reader.restoreValue(KeystoreLocationKey, m_keystoreLocation.toString()).toString());
|
m_keystoreLocation = FilePath::fromString(reader.restoreValue(KeystoreLocationKey, m_keystoreLocation.toString()).toString());
|
||||||
m_toolchainHost = reader.restoreValue(ToolchainHostKey, m_toolchainHost).toString();
|
m_toolchainHost = reader.restoreValue(ToolchainHostKey, m_toolchainHost).toString();
|
||||||
m_automaticKitCreation = reader.restoreValue(AutomaticKitCreationKey, m_automaticKitCreation).toBool();
|
m_automaticKitCreation = reader.restoreValue(AutomaticKitCreationKey, m_automaticKitCreation).toBool();
|
||||||
// persistent settings
|
// persistent settings
|
||||||
@@ -313,17 +313,17 @@ QString AndroidConfig::apiLevelNameFor(const SdkPlatform *platform)
|
|||||||
QString("android-%1").arg(platform->apiLevel()) : "";
|
QString("android-%1").arg(platform->apiLevel()) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::adbToolPath() const
|
FilePath AndroidConfig::adbToolPath() const
|
||||||
{
|
{
|
||||||
return m_sdkLocation.pathAppended("platform-tools/adb" QTC_HOST_EXE_SUFFIX);
|
return m_sdkLocation.pathAppended("platform-tools/adb" QTC_HOST_EXE_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::androidToolPath() const
|
FilePath AndroidConfig::androidToolPath() const
|
||||||
{
|
{
|
||||||
if (HostOsInfo::isWindowsHost()) {
|
if (HostOsInfo::isWindowsHost()) {
|
||||||
// I want to switch from using android.bat to using an executable. All it really does is call
|
// I want to switch from using android.bat to using an executable. All it really does is call
|
||||||
// Java and I've made some progress on it. So if android.exe exists, return that instead.
|
// Java and I've made some progress on it. So if android.exe exists, return that instead.
|
||||||
const FileName path = m_sdkLocation.pathAppended("tools/android" QTC_HOST_EXE_SUFFIX);
|
const FilePath path = m_sdkLocation.pathAppended("tools/android" QTC_HOST_EXE_SUFFIX);
|
||||||
if (path.exists())
|
if (path.exists())
|
||||||
return path;
|
return path;
|
||||||
return m_sdkLocation.pathAppended("tools/android" ANDROID_BAT_SUFFIX);
|
return m_sdkLocation.pathAppended("tools/android" ANDROID_BAT_SUFFIX);
|
||||||
@@ -331,7 +331,7 @@ FileName AndroidConfig::androidToolPath() const
|
|||||||
return m_sdkLocation.pathAppended("tools/android");
|
return m_sdkLocation.pathAppended("tools/android");
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::emulatorToolPath() const
|
FilePath AndroidConfig::emulatorToolPath() const
|
||||||
{
|
{
|
||||||
QString relativePath = "emulator/emulator";
|
QString relativePath = "emulator/emulator";
|
||||||
if (sdkToolsVersion() < QVersionNumber(25, 3, 0))
|
if (sdkToolsVersion() < QVersionNumber(25, 3, 0))
|
||||||
@@ -339,7 +339,7 @@ FileName AndroidConfig::emulatorToolPath() const
|
|||||||
return m_sdkLocation.pathAppended(relativePath + QTC_HOST_EXE_SUFFIX);
|
return m_sdkLocation.pathAppended(relativePath + QTC_HOST_EXE_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::sdkManagerToolPath() const
|
FilePath AndroidConfig::sdkManagerToolPath() const
|
||||||
{
|
{
|
||||||
QString toolPath = "tools/bin/sdkmanager";
|
QString toolPath = "tools/bin/sdkmanager";
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
@@ -347,7 +347,7 @@ FileName AndroidConfig::sdkManagerToolPath() const
|
|||||||
return m_sdkLocation.pathAppended(toolPath);
|
return m_sdkLocation.pathAppended(toolPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::avdManagerToolPath() const
|
FilePath AndroidConfig::avdManagerToolPath() const
|
||||||
{
|
{
|
||||||
QString toolPath = "tools/bin/avdmanager";
|
QString toolPath = "tools/bin/avdmanager";
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
@@ -355,20 +355,20 @@ FileName AndroidConfig::avdManagerToolPath() const
|
|||||||
return m_sdkLocation.pathAppended(toolPath);
|
return m_sdkLocation.pathAppended(toolPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::aaptToolPath() const
|
FilePath AndroidConfig::aaptToolPath() const
|
||||||
{
|
{
|
||||||
const Utils::FileName aaptToolPath = m_sdkLocation.pathAppended("build-tools");
|
const Utils::FilePath aaptToolPath = m_sdkLocation.pathAppended("build-tools");
|
||||||
QString toolPath = QString("%1/aapt").arg(buildToolsVersion().toString());
|
QString toolPath = QString("%1/aapt").arg(buildToolsVersion().toString());
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
toolPath += QTC_HOST_EXE_SUFFIX;
|
toolPath += QTC_HOST_EXE_SUFFIX;
|
||||||
return aaptToolPath.pathAppended(toolPath);
|
return aaptToolPath.pathAppended(toolPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::clangPath() const
|
FilePath AndroidConfig::clangPath() const
|
||||||
{
|
{
|
||||||
const FileName clangPath = m_ndkLocation.pathAppended("toolchains/llvm/prebuilt/");
|
const FilePath clangPath = m_ndkLocation.pathAppended("toolchains/llvm/prebuilt/");
|
||||||
const FileName oldNdkClangPath = m_ndkLocation.pathAppended("toolchains/llvm-3.6/prebuilt/");
|
const FilePath oldNdkClangPath = m_ndkLocation.pathAppended("toolchains/llvm-3.6/prebuilt/");
|
||||||
const QVector<FileName> clangSearchPaths{clangPath, oldNdkClangPath};
|
const QVector<FilePath> clangSearchPaths{clangPath, oldNdkClangPath};
|
||||||
|
|
||||||
// detect toolchain host
|
// detect toolchain host
|
||||||
QStringList hostPatterns;
|
QStringList hostPatterns;
|
||||||
@@ -382,10 +382,10 @@ FileName AndroidConfig::clangPath() const
|
|||||||
case OsTypeMac:
|
case OsTypeMac:
|
||||||
hostPatterns << QLatin1String("darwin*");
|
hostPatterns << QLatin1String("darwin*");
|
||||||
break;
|
break;
|
||||||
default: /* unknown host */ return FileName();
|
default: /* unknown host */ return FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const FileName &path : clangSearchPaths) {
|
for (const FilePath &path : clangSearchPaths) {
|
||||||
QDirIterator iter(path.toString(), hostPatterns, QDir::Dirs);
|
QDirIterator iter(path.toString(), hostPatterns, QDir::Dirs);
|
||||||
if (iter.hasNext()) {
|
if (iter.hasNext()) {
|
||||||
iter.next();
|
iter.next();
|
||||||
@@ -397,9 +397,9 @@ FileName AndroidConfig::clangPath() const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::gdbPath(const ProjectExplorer::Abi &abi) const
|
FilePath AndroidConfig::gdbPath(const ProjectExplorer::Abi &abi) const
|
||||||
{
|
{
|
||||||
const FileName path = m_ndkLocation.pathAppended(
|
const FilePath path = m_ndkLocation.pathAppended(
|
||||||
QString("prebuilt/%1/bin/gdb%2").arg(toolchainHost(), QTC_HOST_EXE_SUFFIX));
|
QString("prebuilt/%1/bin/gdb%2").arg(toolchainHost(), QTC_HOST_EXE_SUFFIX));
|
||||||
if (path.exists())
|
if (path.exists())
|
||||||
return path;
|
return path;
|
||||||
@@ -408,21 +408,21 @@ FileName AndroidConfig::gdbPath(const ProjectExplorer::Abi &abi) const
|
|||||||
.arg(toolchainPrefix(abi), toolchainHost(), toolsPrefix(abi), QTC_HOST_EXE_SUFFIX));
|
.arg(toolchainPrefix(abi), toolchainHost(), toolsPrefix(abi), QTC_HOST_EXE_SUFFIX));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::makePath() const
|
FilePath AndroidConfig::makePath() const
|
||||||
{
|
{
|
||||||
return m_ndkLocation.pathAppended(
|
return m_ndkLocation.pathAppended(
|
||||||
QString("prebuilt/%1/bin/make%2").arg(toolchainHost(), QTC_HOST_EXE_SUFFIX));
|
QString("prebuilt/%1/bin/make%2").arg(toolchainHost(), QTC_HOST_EXE_SUFFIX));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::openJDKBinPath() const
|
FilePath AndroidConfig::openJDKBinPath() const
|
||||||
{
|
{
|
||||||
const FileName path = m_openJDKLocation;
|
const FilePath path = m_openJDKLocation;
|
||||||
if (!path.isEmpty())
|
if (!path.isEmpty())
|
||||||
return path.pathAppended("bin");
|
return path.pathAppended("bin");
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::keytoolPath() const
|
FilePath AndroidConfig::keytoolPath() const
|
||||||
{
|
{
|
||||||
return openJDKBinPath().pathAppended(keytoolName);
|
return openJDKBinPath().pathAppended(keytoolName);
|
||||||
}
|
}
|
||||||
@@ -685,12 +685,12 @@ QString AndroidConfig::bestNdkPlatformMatch(int target) const
|
|||||||
return QString("android-%1").arg(AndroidManager::apiLevelRange().first);
|
return QString("android-%1").arg(AndroidManager::apiLevelRange().first);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::sdkLocation() const
|
FilePath AndroidConfig::sdkLocation() const
|
||||||
{
|
{
|
||||||
return m_sdkLocation;
|
return m_sdkLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidConfig::setSdkLocation(const FileName &sdkLocation)
|
void AndroidConfig::setSdkLocation(const FilePath &sdkLocation)
|
||||||
{
|
{
|
||||||
m_sdkLocation = sdkLocation;
|
m_sdkLocation = sdkLocation;
|
||||||
}
|
}
|
||||||
@@ -699,7 +699,7 @@ QVersionNumber AndroidConfig::sdkToolsVersion() const
|
|||||||
{
|
{
|
||||||
QVersionNumber version;
|
QVersionNumber version;
|
||||||
if (m_sdkLocation.exists()) {
|
if (m_sdkLocation.exists()) {
|
||||||
const Utils::FileName sdkToolsPropertiesPath
|
const Utils::FilePath sdkToolsPropertiesPath
|
||||||
= m_sdkLocation.pathAppended("tools/source.properties");
|
= m_sdkLocation.pathAppended("tools/source.properties");
|
||||||
QSettings settings(sdkToolsPropertiesPath.toString(), QSettings::IniFormat);
|
QSettings settings(sdkToolsPropertiesPath.toString(), QSettings::IniFormat);
|
||||||
auto versionStr = settings.value(sdkToolsVersionKey).toString();
|
auto versionStr = settings.value(sdkToolsVersionKey).toString();
|
||||||
@@ -728,7 +728,7 @@ void AndroidConfig::setSdkManagerToolArgs(const QStringList &args)
|
|||||||
m_sdkManagerToolArgs = args;
|
m_sdkManagerToolArgs = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::ndkLocation() const
|
FilePath AndroidConfig::ndkLocation() const
|
||||||
{
|
{
|
||||||
return m_ndkLocation;
|
return m_ndkLocation;
|
||||||
}
|
}
|
||||||
@@ -744,9 +744,9 @@ static inline QString gdbServerArch(const Abi &abi)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::gdbServer(const ProjectExplorer::Abi &abi) const
|
FilePath AndroidConfig::gdbServer(const ProjectExplorer::Abi &abi) const
|
||||||
{
|
{
|
||||||
const FileName path = AndroidConfigurations::currentConfig().ndkLocation()
|
const FilePath path = AndroidConfigurations::currentConfig().ndkLocation()
|
||||||
.pathAppended(QString("prebuilt/android-%1/gdbserver/gdbserver")
|
.pathAppended(QString("prebuilt/android-%1/gdbserver/gdbserver")
|
||||||
.arg(gdbServerArch(abi)));
|
.arg(gdbServerArch(abi)));
|
||||||
if (path.exists())
|
if (path.exists())
|
||||||
@@ -763,7 +763,7 @@ QVersionNumber AndroidConfig::ndkVersion() const
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileName ndkPropertiesPath = m_ndkLocation.pathAppended("source.properties");
|
const FilePath ndkPropertiesPath = m_ndkLocation.pathAppended("source.properties");
|
||||||
if (ndkPropertiesPath.exists()) {
|
if (ndkPropertiesPath.exists()) {
|
||||||
// source.properties files exists in NDK version > 11
|
// source.properties files exists in NDK version > 11
|
||||||
QSettings settings(ndkPropertiesPath.toString(), QSettings::IniFormat);
|
QSettings settings(ndkPropertiesPath.toString(), QSettings::IniFormat);
|
||||||
@@ -771,7 +771,7 @@ QVersionNumber AndroidConfig::ndkVersion() const
|
|||||||
version = QVersionNumber::fromString(versionStr);
|
version = QVersionNumber::fromString(versionStr);
|
||||||
} else {
|
} else {
|
||||||
// No source.properties. There should be a file named RELEASE.TXT
|
// No source.properties. There should be a file named RELEASE.TXT
|
||||||
const FileName ndkReleaseTxtPath = m_ndkLocation.pathAppended("RELEASE.TXT");
|
const FilePath ndkReleaseTxtPath = m_ndkLocation.pathAppended("RELEASE.TXT");
|
||||||
Utils::FileReader reader;
|
Utils::FileReader reader;
|
||||||
QString errorString;
|
QString errorString;
|
||||||
if (reader.fetch(ndkReleaseTxtPath.toString(), &errorString)) {
|
if (reader.fetch(ndkReleaseTxtPath.toString(), &errorString)) {
|
||||||
@@ -799,28 +799,28 @@ QVersionNumber AndroidConfig::ndkVersion() const
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidConfig::setNdkLocation(const FileName &ndkLocation)
|
void AndroidConfig::setNdkLocation(const FilePath &ndkLocation)
|
||||||
{
|
{
|
||||||
m_ndkLocation = ndkLocation;
|
m_ndkLocation = ndkLocation;
|
||||||
m_NdkInformationUpToDate = false;
|
m_NdkInformationUpToDate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::openJDKLocation() const
|
FilePath AndroidConfig::openJDKLocation() const
|
||||||
{
|
{
|
||||||
return m_openJDKLocation;
|
return m_openJDKLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidConfig::setOpenJDKLocation(const FileName &openJDKLocation)
|
void AndroidConfig::setOpenJDKLocation(const FilePath &openJDKLocation)
|
||||||
{
|
{
|
||||||
m_openJDKLocation = openJDKLocation;
|
m_openJDKLocation = openJDKLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::keystoreLocation() const
|
FilePath AndroidConfig::keystoreLocation() const
|
||||||
{
|
{
|
||||||
return m_keystoreLocation;
|
return m_keystoreLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidConfig::setKeystoreLocation(const FileName &keystoreLocation)
|
void AndroidConfig::setKeystoreLocation(const FilePath &keystoreLocation)
|
||||||
{
|
{
|
||||||
m_keystoreLocation = keystoreLocation;
|
m_keystoreLocation = keystoreLocation;
|
||||||
}
|
}
|
||||||
@@ -851,12 +851,12 @@ void AndroidConfig::setAutomaticKitCreation(bool b)
|
|||||||
m_automaticKitCreation = b;
|
m_automaticKitCreation = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidConfig::qtLiveApkPath() const
|
FilePath AndroidConfig::qtLiveApkPath() const
|
||||||
{
|
{
|
||||||
QString apkPathStr(defaultQtLiveApk);
|
QString apkPathStr(defaultQtLiveApk);
|
||||||
if (qEnvironmentVariableIsSet("QTC_QT_LIVE_APK_PATH"))
|
if (qEnvironmentVariableIsSet("QTC_QT_LIVE_APK_PATH"))
|
||||||
apkPathStr = QString::fromLocal8Bit(qgetenv("QTC_QT_LIVE_APK_PATH"));
|
apkPathStr = QString::fromLocal8Bit(qgetenv("QTC_QT_LIVE_APK_PATH"));
|
||||||
return Utils::FileName::fromString(apkPathStr);
|
return Utils::FilePath::fromString(apkPathStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
@@ -947,7 +947,7 @@ void AndroidConfigurations::removeOldToolChains()
|
|||||||
|
|
||||||
static QVariant findOrRegisterDebugger(ToolChain *tc)
|
static QVariant findOrRegisterDebugger(ToolChain *tc)
|
||||||
{
|
{
|
||||||
const FileName command = tc->suggestedDebugger();
|
const FilePath command = tc->suggestedDebugger();
|
||||||
// check if the debugger is already registered, but ignoring the display name
|
// check if the debugger is already registered, but ignoring the display name
|
||||||
const Debugger::DebuggerItem *existing = Debugger::DebuggerItemManager::findByCommand(command);
|
const Debugger::DebuggerItem *existing = Debugger::DebuggerItemManager::findByCommand(command);
|
||||||
if (existing && existing->engineType() == Debugger::GdbEngineType && existing->isAutoDetected()
|
if (existing && existing->engineType() == Debugger::GdbEngineType && existing->isAutoDetected()
|
||||||
@@ -1074,7 +1074,7 @@ bool AndroidConfigurations::force32bitEmulator()
|
|||||||
QProcessEnvironment AndroidConfigurations::toolsEnvironment(const AndroidConfig &config)
|
QProcessEnvironment AndroidConfigurations::toolsEnvironment(const AndroidConfig &config)
|
||||||
{
|
{
|
||||||
Environment env = Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
Utils::FileName jdkLocation = config.openJDKLocation();
|
Utils::FilePath jdkLocation = config.openJDKLocation();
|
||||||
if (!jdkLocation.isEmpty()) {
|
if (!jdkLocation.isEmpty()) {
|
||||||
env.set("JAVA_HOME", jdkLocation.toUserOutput());
|
env.set("JAVA_HOME", jdkLocation.toUserOutput());
|
||||||
env.prependOrSetPath(jdkLocation.pathAppended("bin").toUserOutput());
|
env.prependOrSetPath(jdkLocation.pathAppended("bin").toUserOutput());
|
||||||
@@ -1147,7 +1147,7 @@ AndroidConfigurations::AndroidConfigurations()
|
|||||||
|
|
||||||
AndroidConfigurations::~AndroidConfigurations() = default;
|
AndroidConfigurations::~AndroidConfigurations() = default;
|
||||||
|
|
||||||
static FileName javaHomeForJavac(const FileName &location)
|
static FilePath javaHomeForJavac(const FilePath &location)
|
||||||
{
|
{
|
||||||
QFileInfo fileInfo = location.toFileInfo();
|
QFileInfo fileInfo = location.toFileInfo();
|
||||||
int tries = 5;
|
int tries = 5;
|
||||||
@@ -1155,14 +1155,14 @@ static FileName javaHomeForJavac(const FileName &location)
|
|||||||
QDir dir = fileInfo.dir();
|
QDir dir = fileInfo.dir();
|
||||||
dir.cdUp();
|
dir.cdUp();
|
||||||
if (QFileInfo::exists(dir.filePath(QLatin1String("lib/tools.jar"))))
|
if (QFileInfo::exists(dir.filePath(QLatin1String("lib/tools.jar"))))
|
||||||
return FileName::fromString(dir.path());
|
return FilePath::fromString(dir.path());
|
||||||
if (fileInfo.isSymLink())
|
if (fileInfo.isSymLink())
|
||||||
fileInfo.setFile(fileInfo.symLinkTarget());
|
fileInfo.setFile(fileInfo.symLinkTarget());
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
--tries;
|
--tries;
|
||||||
}
|
}
|
||||||
return FileName();
|
return FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidConfigurations::load()
|
void AndroidConfigurations::load()
|
||||||
@@ -1175,7 +1175,7 @@ void AndroidConfigurations::load()
|
|||||||
if (m_config.openJDKLocation().isEmpty()) {
|
if (m_config.openJDKLocation().isEmpty()) {
|
||||||
if (HostOsInfo::isLinuxHost()) {
|
if (HostOsInfo::isLinuxHost()) {
|
||||||
Environment env = Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
FileName location = env.searchInPath(QLatin1String("javac"));
|
FilePath location = env.searchInPath(QLatin1String("javac"));
|
||||||
QFileInfo fi = location.toFileInfo();
|
QFileInfo fi = location.toFileInfo();
|
||||||
if (fi.exists() && fi.isExecutable() && !fi.isDir()) {
|
if (fi.exists() && fi.isExecutable() && !fi.isDir()) {
|
||||||
m_config.setOpenJDKLocation(javaHomeForJavac(location));
|
m_config.setOpenJDKLocation(javaHomeForJavac(location));
|
||||||
@@ -1191,7 +1191,7 @@ void AndroidConfigurations::load()
|
|||||||
if (response.result == SynchronousProcessResponse::Finished) {
|
if (response.result == SynchronousProcessResponse::Finished) {
|
||||||
const QString &javaHome = response.allOutput().trimmed();
|
const QString &javaHome = response.allOutput().trimmed();
|
||||||
if (!javaHome.isEmpty() && QFileInfo::exists(javaHome))
|
if (!javaHome.isEmpty() && QFileInfo::exists(javaHome))
|
||||||
m_config.setOpenJDKLocation(FileName::fromString(javaHome));
|
m_config.setOpenJDKLocation(FilePath::fromString(javaHome));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (HostOsInfo::isWindowsHost()) {
|
} else if (HostOsInfo::isWindowsHost()) {
|
||||||
@@ -1233,7 +1233,7 @@ void AndroidConfigurations::load()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!javaHome.isEmpty()) {
|
if (!javaHome.isEmpty()) {
|
||||||
m_config.setOpenJDKLocation(FileName::fromString(javaHome));
|
m_config.setOpenJDKLocation(FilePath::fromString(javaHome));
|
||||||
saveSettings = true;
|
saveSettings = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -97,23 +97,23 @@ public:
|
|||||||
static QStringList apiLevelNamesFor(const SdkPlatformList &platforms);
|
static QStringList apiLevelNamesFor(const SdkPlatformList &platforms);
|
||||||
static QString apiLevelNameFor(const SdkPlatform *platform);
|
static QString apiLevelNameFor(const SdkPlatform *platform);
|
||||||
|
|
||||||
Utils::FileName sdkLocation() const;
|
Utils::FilePath sdkLocation() const;
|
||||||
void setSdkLocation(const Utils::FileName &sdkLocation);
|
void setSdkLocation(const Utils::FilePath &sdkLocation);
|
||||||
QVersionNumber sdkToolsVersion() const;
|
QVersionNumber sdkToolsVersion() const;
|
||||||
QVersionNumber buildToolsVersion() const;
|
QVersionNumber buildToolsVersion() const;
|
||||||
QStringList sdkManagerToolArgs() const;
|
QStringList sdkManagerToolArgs() const;
|
||||||
void setSdkManagerToolArgs(const QStringList &args);
|
void setSdkManagerToolArgs(const QStringList &args);
|
||||||
|
|
||||||
Utils::FileName ndkLocation() const;
|
Utils::FilePath ndkLocation() const;
|
||||||
Utils::FileName gdbServer(const ProjectExplorer::Abi &abi) const;
|
Utils::FilePath gdbServer(const ProjectExplorer::Abi &abi) const;
|
||||||
QVersionNumber ndkVersion() const;
|
QVersionNumber ndkVersion() const;
|
||||||
void setNdkLocation(const Utils::FileName &ndkLocation);
|
void setNdkLocation(const Utils::FilePath &ndkLocation);
|
||||||
|
|
||||||
Utils::FileName openJDKLocation() const;
|
Utils::FilePath openJDKLocation() const;
|
||||||
void setOpenJDKLocation(const Utils::FileName &openJDKLocation);
|
void setOpenJDKLocation(const Utils::FilePath &openJDKLocation);
|
||||||
|
|
||||||
Utils::FileName keystoreLocation() const;
|
Utils::FilePath keystoreLocation() const;
|
||||||
void setKeystoreLocation(const Utils::FileName &keystoreLocation);
|
void setKeystoreLocation(const Utils::FilePath &keystoreLocation);
|
||||||
|
|
||||||
QString toolchainHost() const;
|
QString toolchainHost() const;
|
||||||
|
|
||||||
@@ -123,20 +123,20 @@ public:
|
|||||||
bool automaticKitCreation() const;
|
bool automaticKitCreation() const;
|
||||||
void setAutomaticKitCreation(bool b);
|
void setAutomaticKitCreation(bool b);
|
||||||
|
|
||||||
Utils::FileName qtLiveApkPath() const;
|
Utils::FilePath qtLiveApkPath() const;
|
||||||
|
|
||||||
Utils::FileName adbToolPath() const;
|
Utils::FilePath adbToolPath() const;
|
||||||
Utils::FileName androidToolPath() const;
|
Utils::FilePath androidToolPath() const;
|
||||||
Utils::FileName emulatorToolPath() const;
|
Utils::FilePath emulatorToolPath() const;
|
||||||
Utils::FileName sdkManagerToolPath() const;
|
Utils::FilePath sdkManagerToolPath() const;
|
||||||
Utils::FileName avdManagerToolPath() const;
|
Utils::FilePath avdManagerToolPath() const;
|
||||||
Utils::FileName aaptToolPath() const;
|
Utils::FilePath aaptToolPath() const;
|
||||||
|
|
||||||
Utils::FileName clangPath() const;
|
Utils::FilePath clangPath() const;
|
||||||
Utils::FileName gdbPath(const ProjectExplorer::Abi &abi) const;
|
Utils::FilePath gdbPath(const ProjectExplorer::Abi &abi) const;
|
||||||
Utils::FileName makePath() const;
|
Utils::FilePath makePath() const;
|
||||||
|
|
||||||
Utils::FileName keytoolPath() const;
|
Utils::FilePath keytoolPath() const;
|
||||||
|
|
||||||
QVector<AndroidDeviceInfo> connectedDevices(QString *error = nullptr) const;
|
QVector<AndroidDeviceInfo> connectedDevices(QString *error = nullptr) const;
|
||||||
static QVector<AndroidDeviceInfo> connectedDevices(const QString &adbToolPath, QString *error = nullptr);
|
static QVector<AndroidDeviceInfo> connectedDevices(const QString &adbToolPath, QString *error = nullptr);
|
||||||
@@ -158,7 +158,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
static QString getDeviceProperty(const QString &adbToolPath, const QString &device, const QString &property);
|
static QString getDeviceProperty(const QString &adbToolPath, const QString &device, const QString &property);
|
||||||
|
|
||||||
Utils::FileName openJDKBinPath() const;
|
Utils::FilePath openJDKBinPath() const;
|
||||||
int getSDKVersion(const QString &device) const;
|
int getSDKVersion(const QString &device) const;
|
||||||
static int getSDKVersion(const QString &adbToolPath, const QString &device);
|
static int getSDKVersion(const QString &adbToolPath, const QString &device);
|
||||||
QStringList getAbis(const QString &device) const;
|
QStringList getAbis(const QString &device) const;
|
||||||
@@ -169,11 +169,11 @@ private:
|
|||||||
|
|
||||||
void updateNdkInformation() const;
|
void updateNdkInformation() const;
|
||||||
|
|
||||||
Utils::FileName m_sdkLocation;
|
Utils::FilePath m_sdkLocation;
|
||||||
QStringList m_sdkManagerToolArgs;
|
QStringList m_sdkManagerToolArgs;
|
||||||
Utils::FileName m_ndkLocation;
|
Utils::FilePath m_ndkLocation;
|
||||||
Utils::FileName m_openJDKLocation;
|
Utils::FilePath m_openJDKLocation;
|
||||||
Utils::FileName m_keystoreLocation;
|
Utils::FilePath m_keystoreLocation;
|
||||||
unsigned m_partitionSize = 1024;
|
unsigned m_partitionSize = 1024;
|
||||||
bool m_automaticKitCreation = true;
|
bool m_automaticKitCreation = true;
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ AndroidCreateKeystoreCertificate::~AndroidCreateKeystoreCertificate()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName AndroidCreateKeystoreCertificate::keystoreFilePath()
|
Utils::FilePath AndroidCreateKeystoreCertificate::keystoreFilePath()
|
||||||
{
|
{
|
||||||
return m_keystoreFilePath;
|
return m_keystoreFilePath;
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ void AndroidCreateKeystoreCertificate::on_buttonBox_accepted()
|
|||||||
if (!validateUserInput())
|
if (!validateUserInput())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_keystoreFilePath = Utils::FileName::fromString(QFileDialog::getSaveFileName(this, tr("Keystore Filename"),
|
m_keystoreFilePath = Utils::FilePath::fromString(QFileDialog::getSaveFileName(this, tr("Keystore Filename"),
|
||||||
QDir::homePath() + QLatin1String("/android_release.keystore"),
|
QDir::homePath() + QLatin1String("/android_release.keystore"),
|
||||||
tr("Keystore files (*.keystore *.jks)")));
|
tr("Keystore files (*.keystore *.jks)")));
|
||||||
if (m_keystoreFilePath.isEmpty())
|
if (m_keystoreFilePath.isEmpty())
|
||||||
|
@@ -49,7 +49,7 @@ class AndroidCreateKeystoreCertificate : public QDialog
|
|||||||
public:
|
public:
|
||||||
explicit AndroidCreateKeystoreCertificate(QWidget *parent = nullptr);
|
explicit AndroidCreateKeystoreCertificate(QWidget *parent = nullptr);
|
||||||
~AndroidCreateKeystoreCertificate() override;
|
~AndroidCreateKeystoreCertificate() override;
|
||||||
Utils::FileName keystoreFilePath();
|
Utils::FilePath keystoreFilePath();
|
||||||
QString keystorePassword();
|
QString keystorePassword();
|
||||||
QString certificateAlias();
|
QString certificateAlias();
|
||||||
QString certificatePassword();
|
QString certificatePassword();
|
||||||
@@ -69,7 +69,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
bool validateUserInput();
|
bool validateUserInput();
|
||||||
Ui::AndroidCreateKeystoreCertificate *ui;
|
Ui::AndroidCreateKeystoreCertificate *ui;
|
||||||
Utils::FileName m_keystoreFilePath;
|
Utils::FilePath m_keystoreFilePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -190,7 +190,7 @@ void AndroidDebugSupport::start()
|
|||||||
const int minimumNdk = qt ? qt->minimumNDK() : 0;
|
const int minimumNdk = qt ? qt->minimumNDK() : 0;
|
||||||
|
|
||||||
int sdkVersion = qMax(AndroidManager::minimumSDK(kit), minimumNdk);
|
int sdkVersion = qMax(AndroidManager::minimumSDK(kit), minimumNdk);
|
||||||
Utils::FileName sysRoot = AndroidConfigurations::currentConfig().ndkLocation()
|
Utils::FilePath sysRoot = AndroidConfigurations::currentConfig().ndkLocation()
|
||||||
.pathAppended("platforms")
|
.pathAppended("platforms")
|
||||||
.pathAppended(QString("android-%1").arg(sdkVersion))
|
.pathAppended(QString("android-%1").arg(sdkVersion))
|
||||||
.pathAppended(toNdkArch(AndroidManager::targetArch(target)));
|
.pathAppended(toNdkArch(AndroidManager::targetArch(target)));
|
||||||
|
@@ -232,9 +232,9 @@ bool AndroidDeployQtStep::init()
|
|||||||
|
|
||||||
if (m_useAndroiddeployqt) {
|
if (m_useAndroiddeployqt) {
|
||||||
const ProjectNode *node = target()->project()->findNodeForBuildKey(rc->buildKey());
|
const ProjectNode *node = target()->project()->findNodeForBuildKey(rc->buildKey());
|
||||||
m_apkPath = Utils::FileName::fromString(node->data(Constants::AndroidApk).toString());
|
m_apkPath = Utils::FilePath::fromString(node->data(Constants::AndroidApk).toString());
|
||||||
if (!m_apkPath.isEmpty()) {
|
if (!m_apkPath.isEmpty()) {
|
||||||
m_manifestName = Utils::FileName::fromString(node->data(Constants::AndroidManifest).toString());
|
m_manifestName = Utils::FilePath::fromString(node->data(Constants::AndroidManifest).toString());
|
||||||
m_command = AndroidConfigurations::currentConfig().adbToolPath().toString();
|
m_command = AndroidConfigurations::currentConfig().adbToolPath().toString();
|
||||||
AndroidManager::setManifestPath(target(), m_manifestName);
|
AndroidManager::setManifestPath(target(), m_manifestName);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -106,10 +106,10 @@ private:
|
|||||||
friend void operator|=(DeployErrorCode &e1, const DeployErrorCode &e2) { e1 = static_cast<AndroidDeployQtStep::DeployErrorCode>((int)e1 | (int)e2); }
|
friend void operator|=(DeployErrorCode &e1, const DeployErrorCode &e2) { e1 = static_cast<AndroidDeployQtStep::DeployErrorCode>((int)e1 | (int)e2); }
|
||||||
friend DeployErrorCode operator|(const DeployErrorCode &e1, const DeployErrorCode &e2) { return static_cast<AndroidDeployQtStep::DeployErrorCode>((int)e1 | (int)e2); }
|
friend DeployErrorCode operator|(const DeployErrorCode &e1, const DeployErrorCode &e2) { return static_cast<AndroidDeployQtStep::DeployErrorCode>((int)e1 | (int)e2); }
|
||||||
|
|
||||||
Utils::FileName m_manifestName;
|
Utils::FilePath m_manifestName;
|
||||||
QString m_serialNumber;
|
QString m_serialNumber;
|
||||||
QString m_avdName;
|
QString m_avdName;
|
||||||
Utils::FileName m_apkPath;
|
Utils::FilePath m_apkPath;
|
||||||
QMap<QString, QString> m_filesToPull;
|
QMap<QString, QString> m_filesToPull;
|
||||||
|
|
||||||
QString m_targetArch;
|
QString m_targetArch;
|
||||||
|
@@ -112,23 +112,23 @@ Core::Id AndroidGdbServerKitAspect::id()
|
|||||||
return "Android.GdbServer.Information";
|
return "Android.GdbServer.Information";
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidGdbServerKitAspect::gdbServer(const Kit *kit)
|
FilePath AndroidGdbServerKitAspect::gdbServer(const Kit *kit)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(kit, return FileName());
|
QTC_ASSERT(kit, return FilePath());
|
||||||
return FileName::fromString(kit->value(AndroidGdbServerKitAspect::id()).toString());
|
return FilePath::fromString(kit->value(AndroidGdbServerKitAspect::id()).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidGdbServerKitAspect::setGdbSever(Kit *kit, const FileName &gdbServerCommand)
|
void AndroidGdbServerKitAspect::setGdbSever(Kit *kit, const FilePath &gdbServerCommand)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(kit, return);
|
QTC_ASSERT(kit, return);
|
||||||
kit->setValue(AndroidGdbServerKitAspect::id(), gdbServerCommand.toString());
|
kit->setValue(AndroidGdbServerKitAspect::id(), gdbServerCommand.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidGdbServerKitAspect::autoDetect(const Kit *kit)
|
FilePath AndroidGdbServerKitAspect::autoDetect(const Kit *kit)
|
||||||
{
|
{
|
||||||
ToolChain *tc = ToolChainKitAspect::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
ToolChain *tc = ToolChainKitAspect::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||||
if (!tc || tc->typeId() != Constants::ANDROID_TOOLCHAIN_ID)
|
if (!tc || tc->typeId() != Constants::ANDROID_TOOLCHAIN_ID)
|
||||||
return FileName();
|
return FilePath();
|
||||||
auto atc = static_cast<AndroidToolChain *>(tc);
|
auto atc = static_cast<AndroidToolChain *>(tc);
|
||||||
return atc->suggestedGdbServer();
|
return atc->suggestedGdbServer();
|
||||||
}
|
}
|
||||||
|
@@ -44,9 +44,9 @@ public:
|
|||||||
ProjectExplorer::KitAspectWidget *createConfigWidget(ProjectExplorer::Kit *) const override;
|
ProjectExplorer::KitAspectWidget *createConfigWidget(ProjectExplorer::Kit *) const override;
|
||||||
|
|
||||||
static Core::Id id();
|
static Core::Id id();
|
||||||
static Utils::FileName gdbServer(const ProjectExplorer::Kit *kit);
|
static Utils::FilePath gdbServer(const ProjectExplorer::Kit *kit);
|
||||||
static void setGdbSever(ProjectExplorer::Kit *kit, const Utils::FileName &gdbServerCommand);
|
static void setGdbSever(ProjectExplorer::Kit *kit, const Utils::FilePath &gdbServerCommand);
|
||||||
static Utils::FileName autoDetect(const ProjectExplorer::Kit *kit);
|
static Utils::FilePath autoDetect(const ProjectExplorer::Kit *kit);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -109,7 +109,7 @@ public:
|
|||||||
|
|
||||||
using LibrariesMap = QMap<QString, Library>;
|
using LibrariesMap = QMap<QString, Library>;
|
||||||
|
|
||||||
static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName);
|
static bool openXmlFile(QDomDocument &doc, const Utils::FilePath &fileName);
|
||||||
static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc);
|
static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc);
|
||||||
static int parseMinSdk(const QDomElement &manifestElem);
|
static int parseMinSdk(const QDomElement &manifestElem);
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ QString AndroidManager::packageName(ProjectExplorer::Target *target)
|
|||||||
return manifestElem.attribute(QLatin1String("package"));
|
return manifestElem.attribute(QLatin1String("package"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AndroidManager::packageName(const Utils::FileName &manifestFile)
|
QString AndroidManager::packageName(const Utils::FilePath &manifestFile)
|
||||||
{
|
{
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
if (!openXmlFile(doc, manifestFile))
|
if (!openXmlFile(doc, manifestFile))
|
||||||
@@ -174,7 +174,7 @@ int AndroidManager::packageVersionCode(const QString &deviceSerial,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidManager::apkInfo(const Utils::FileName &apkPath,
|
void AndroidManager::apkInfo(const Utils::FilePath &apkPath,
|
||||||
QString *packageName,
|
QString *packageName,
|
||||||
int *version,
|
int *version,
|
||||||
QString *activityPath)
|
QString *activityPath)
|
||||||
@@ -237,8 +237,8 @@ int AndroidManager::minimumSDK(const ProjectExplorer::Kit *kit)
|
|||||||
int minSDKVersion = -1;
|
int minSDKVersion = -1;
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit);
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit);
|
||||||
if (version && version->targetDeviceTypes().contains(Constants::ANDROID_DEVICE_TYPE)) {
|
if (version && version->targetDeviceTypes().contains(Constants::ANDROID_DEVICE_TYPE)) {
|
||||||
Utils::FileName stockManifestFilePath =
|
Utils::FilePath stockManifestFilePath =
|
||||||
Utils::FileName::fromUserInput(version->qmakeProperty("QT_INSTALL_PREFIX") +
|
Utils::FilePath::fromUserInput(version->qmakeProperty("QT_INSTALL_PREFIX") +
|
||||||
QLatin1String("/src/android/templates/AndroidManifest.xml"));
|
QLatin1String("/src/android/templates/AndroidManifest.xml"));
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
if (openXmlFile(doc, stockManifestFilePath)) {
|
if (openXmlFile(doc, stockManifestFilePath)) {
|
||||||
@@ -292,20 +292,20 @@ QJsonObject AndroidManager::deploymentSettings(const Target *target)
|
|||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName AndroidManager::dirPath(const ProjectExplorer::Target *target)
|
Utils::FilePath AndroidManager::dirPath(const ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
if (target->activeBuildConfiguration())
|
if (target->activeBuildConfiguration())
|
||||||
return target->activeBuildConfiguration()->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY);
|
return target->activeBuildConfiguration()->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY);
|
||||||
return Utils::FileName();
|
return Utils::FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName AndroidManager::apkPath(const ProjectExplorer::Target *target)
|
Utils::FilePath AndroidManager::apkPath(const ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(target, return Utils::FileName());
|
QTC_ASSERT(target, return Utils::FilePath());
|
||||||
|
|
||||||
auto buildApkStep = AndroidBuildApkStep::findInBuild(target->activeBuildConfiguration());
|
auto buildApkStep = AndroidBuildApkStep::findInBuild(target->activeBuildConfiguration());
|
||||||
if (!buildApkStep)
|
if (!buildApkStep)
|
||||||
return Utils::FileName();
|
return Utils::FilePath();
|
||||||
|
|
||||||
QString apkPath("build/outputs/apk/android-build-");
|
QString apkPath("build/outputs/apk/android-build-");
|
||||||
if (buildApkStep->signPackage())
|
if (buildApkStep->signPackage())
|
||||||
@@ -316,13 +316,13 @@ Utils::FileName AndroidManager::apkPath(const ProjectExplorer::Target *target)
|
|||||||
return dirPath(target).pathAppended(apkPath);
|
return dirPath(target).pathAppended(apkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName AndroidManager::manifestSourcePath(ProjectExplorer::Target *target)
|
Utils::FilePath AndroidManager::manifestSourcePath(ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
if (const ProjectNode *node = currentProjectNode(target)) {
|
if (const ProjectNode *node = currentProjectNode(target)) {
|
||||||
const QString packageSource
|
const QString packageSource
|
||||||
= node->data(Android::Constants::AndroidPackageSourceDir).toString();
|
= node->data(Android::Constants::AndroidPackageSourceDir).toString();
|
||||||
if (!packageSource.isEmpty()) {
|
if (!packageSource.isEmpty()) {
|
||||||
const FileName manifest = FileName::fromUserInput(packageSource + "/AndroidManifest.xml");
|
const FilePath manifest = FilePath::fromUserInput(packageSource + "/AndroidManifest.xml");
|
||||||
if (manifest.exists())
|
if (manifest.exists())
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
@@ -330,20 +330,20 @@ Utils::FileName AndroidManager::manifestSourcePath(ProjectExplorer::Target *targ
|
|||||||
return manifestPath(target);
|
return manifestPath(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName AndroidManager::manifestPath(ProjectExplorer::Target *target)
|
Utils::FilePath AndroidManager::manifestPath(ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
QVariant manifest = target->namedSettings(AndroidManifestName);
|
QVariant manifest = target->namedSettings(AndroidManifestName);
|
||||||
if (manifest.isValid())
|
if (manifest.isValid())
|
||||||
return manifest.value<FileName>();
|
return manifest.value<FilePath>();
|
||||||
return dirPath(target).pathAppended(AndroidManifestName);
|
return dirPath(target).pathAppended(AndroidManifestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidManager::setManifestPath(Target *target, const FileName &path)
|
void AndroidManager::setManifestPath(Target *target, const FilePath &path)
|
||||||
{
|
{
|
||||||
target->setNamedSettings(AndroidManifestName, QVariant::fromValue(path));
|
target->setNamedSettings(AndroidManifestName, QVariant::fromValue(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName AndroidManager::defaultPropertiesPath(ProjectExplorer::Target *target)
|
Utils::FilePath AndroidManager::defaultPropertiesPath(ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
return dirPath(target).pathAppended(AndroidDefaultPropertiesName);
|
return dirPath(target).pathAppended(AndroidDefaultPropertiesName);
|
||||||
}
|
}
|
||||||
@@ -440,7 +440,7 @@ static void raiseError(const QString &reason)
|
|||||||
QMessageBox::critical(nullptr, AndroidManager::tr("Error creating Android templates."), reason);
|
QMessageBox::critical(nullptr, AndroidManager::tr("Error creating Android templates."), reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName)
|
static bool openXmlFile(QDomDocument &doc, const Utils::FilePath &fileName)
|
||||||
{
|
{
|
||||||
QFile f(fileName.toString());
|
QFile f(fileName.toString());
|
||||||
if (!f.open(QIODevice::ReadOnly))
|
if (!f.open(QIODevice::ReadOnly))
|
||||||
@@ -643,12 +643,12 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
|
|||||||
|
|
||||||
const QString sourceDirName = node->data(Constants::AndroidPackageSourceDir).toString();
|
const QString sourceDirName = node->data(Constants::AndroidPackageSourceDir).toString();
|
||||||
QFileInfo sourceDirInfo(sourceDirName);
|
QFileInfo sourceDirInfo(sourceDirName);
|
||||||
const FileName packageSourceDir = FileName::fromString(sourceDirInfo.canonicalFilePath())
|
const FilePath packageSourceDir = FilePath::fromString(sourceDirInfo.canonicalFilePath())
|
||||||
.pathAppended("gradlew");
|
.pathAppended("gradlew");
|
||||||
if (!packageSourceDir.exists())
|
if (!packageSourceDir.exists())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const FileName wrapperProps = packageSourceDir.pathAppended("gradle/wrapper/gradle-wrapper.properties");
|
const FilePath wrapperProps = packageSourceDir.pathAppended("gradle/wrapper/gradle-wrapper.properties");
|
||||||
if (wrapperProps.exists()) {
|
if (wrapperProps.exists()) {
|
||||||
GradleProperties wrapperProperties = readGradleProperties(wrapperProps.toString());
|
GradleProperties wrapperProperties = readGradleProperties(wrapperProps.toString());
|
||||||
QString distributionUrl = QString::fromLocal8Bit(wrapperProperties["distributionUrl"]);
|
QString distributionUrl = QString::fromLocal8Bit(wrapperProperties["distributionUrl"]);
|
||||||
@@ -661,7 +661,7 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
|
|||||||
|
|
||||||
GradleProperties localProperties;
|
GradleProperties localProperties;
|
||||||
localProperties["sdk.dir"] = AndroidConfigurations::currentConfig().sdkLocation().toString().toLocal8Bit();
|
localProperties["sdk.dir"] = AndroidConfigurations::currentConfig().sdkLocation().toString().toLocal8Bit();
|
||||||
const FileName localPropertiesFile = packageSourceDir.pathAppended("local.properties");
|
const FilePath localPropertiesFile = packageSourceDir.pathAppended("local.properties");
|
||||||
if (!mergeGradleProperties(localPropertiesFile.toString(), localProperties))
|
if (!mergeGradleProperties(localPropertiesFile.toString(), localProperties))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -680,10 +680,10 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
|
|||||||
return mergeGradleProperties(gradlePropertiesPath, gradleProperties);
|
return mergeGradleProperties(gradlePropertiesPath, gradleProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AndroidManager::findApiLevel(const Utils::FileName &platformPath)
|
int AndroidManager::findApiLevel(const Utils::FilePath &platformPath)
|
||||||
{
|
{
|
||||||
int apiLevel = -1;
|
int apiLevel = -1;
|
||||||
const Utils::FileName propertiesPath = platformPath.pathAppended("/source.properties");
|
const Utils::FilePath propertiesPath = platformPath.pathAppended("/source.properties");
|
||||||
if (propertiesPath.exists()) {
|
if (propertiesPath.exists()) {
|
||||||
QSettings sdkProperties(propertiesPath.toString(), QSettings::IniFormat);
|
QSettings sdkProperties(propertiesPath.toString(), QSettings::IniFormat);
|
||||||
bool validInt = false;
|
bool validInt = false;
|
||||||
|
@@ -40,7 +40,7 @@ class Kit;
|
|||||||
class Target;
|
class Target;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Utils { class FileName; }
|
namespace Utils { class FilePath; }
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
|
|
||||||
@@ -66,10 +66,10 @@ class ANDROID_EXPORT AndroidManager : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static QString packageName(ProjectExplorer::Target *target);
|
static QString packageName(ProjectExplorer::Target *target);
|
||||||
static QString packageName(const Utils::FileName &manifestFile);
|
static QString packageName(const Utils::FilePath &manifestFile);
|
||||||
static bool packageInstalled(const QString &deviceSerial, const QString &packageName);
|
static bool packageInstalled(const QString &deviceSerial, const QString &packageName);
|
||||||
static int packageVersionCode(const QString &deviceSerial, const QString &packageName);
|
static int packageVersionCode(const QString &deviceSerial, const QString &packageName);
|
||||||
static void apkInfo(const Utils::FileName &apkPath,
|
static void apkInfo(const Utils::FilePath &apkPath,
|
||||||
QString *packageName = nullptr,
|
QString *packageName = nullptr,
|
||||||
int *version = nullptr,
|
int *version = nullptr,
|
||||||
QString *activityPath = nullptr);
|
QString *activityPath = nullptr);
|
||||||
@@ -89,12 +89,12 @@ public:
|
|||||||
|
|
||||||
static QString targetArch(const ProjectExplorer::Target *target);
|
static QString targetArch(const ProjectExplorer::Target *target);
|
||||||
|
|
||||||
static Utils::FileName dirPath(const ProjectExplorer::Target *target);
|
static Utils::FilePath dirPath(const ProjectExplorer::Target *target);
|
||||||
static Utils::FileName manifestPath(ProjectExplorer::Target *target);
|
static Utils::FilePath manifestPath(ProjectExplorer::Target *target);
|
||||||
static void setManifestPath(ProjectExplorer::Target *target, const Utils::FileName &path);
|
static void setManifestPath(ProjectExplorer::Target *target, const Utils::FilePath &path);
|
||||||
static Utils::FileName manifestSourcePath(ProjectExplorer::Target *target);
|
static Utils::FilePath manifestSourcePath(ProjectExplorer::Target *target);
|
||||||
static Utils::FileName defaultPropertiesPath(ProjectExplorer::Target *target);
|
static Utils::FilePath defaultPropertiesPath(ProjectExplorer::Target *target);
|
||||||
static Utils::FileName apkPath(const ProjectExplorer::Target *target);
|
static Utils::FilePath apkPath(const ProjectExplorer::Target *target);
|
||||||
|
|
||||||
static QPair<int, int> apiLevelRange();
|
static QPair<int, int> apiLevelRange();
|
||||||
static QString androidNameForApiLevel(int x);
|
static QString androidNameForApiLevel(int x);
|
||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
static bool checkCertificateExists(const QString &keystorePath, const QString &keystorePasswd,
|
static bool checkCertificateExists(const QString &keystorePath, const QString &keystorePasswd,
|
||||||
const QString &alias);
|
const QString &alias);
|
||||||
static bool updateGradleProperties(ProjectExplorer::Target *target);
|
static bool updateGradleProperties(ProjectExplorer::Target *target);
|
||||||
static int findApiLevel(const Utils::FileName &platformPath);
|
static int findApiLevel(const Utils::FilePath &platformPath);
|
||||||
|
|
||||||
static QProcess *runAdbCommandDetached(const QStringList &args, QString *err = nullptr,
|
static QProcess *runAdbCommandDetached(const QStringList &args, QString *err = nullptr,
|
||||||
bool deleteOnFinish = false);
|
bool deleteOnFinish = false);
|
||||||
|
@@ -85,7 +85,7 @@ bool checkPackageName(const QString &packageName)
|
|||||||
return QRegExp(packageNameRegExp).exactMatch(packageName);
|
return QRegExp(packageNameRegExp).exactMatch(packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Project *androidProject(const Utils::FileName &fileName)
|
Project *androidProject(const Utils::FilePath &fileName)
|
||||||
{
|
{
|
||||||
for (Project *project : SessionManager::projects()) {
|
for (Project *project : SessionManager::projects()) {
|
||||||
if (!project->activeTarget())
|
if (!project->activeTarget())
|
||||||
@@ -604,7 +604,7 @@ void AndroidManifestEditorWidget::preSave()
|
|||||||
|
|
||||||
void AndroidManifestEditorWidget::postSave()
|
void AndroidManifestEditorWidget::postSave()
|
||||||
{
|
{
|
||||||
const Utils::FileName docPath = m_textEditorWidget->textDocument()->filePath();
|
const Utils::FilePath docPath = m_textEditorWidget->textDocument()->filePath();
|
||||||
ProjectExplorer::Project *project = androidProject(docPath);
|
ProjectExplorer::Project *project = androidProject(docPath);
|
||||||
if (project) {
|
if (project) {
|
||||||
if (Target *target = project->activeTarget()) {
|
if (Target *target = project->activeTarget()) {
|
||||||
|
@@ -100,7 +100,7 @@ void AndroidPackageInstallationStep::doRun()
|
|||||||
{
|
{
|
||||||
QString error;
|
QString error;
|
||||||
foreach (const QString &dir, m_androidDirsToClean) {
|
foreach (const QString &dir, m_androidDirsToClean) {
|
||||||
FileName androidDir = FileName::fromString(dir);
|
FilePath androidDir = FilePath::fromString(dir);
|
||||||
if (!dir.isEmpty() && androidDir.exists()) {
|
if (!dir.isEmpty() && androidDir.exists()) {
|
||||||
emit addOutput(tr("Removing directory %1").arg(dir), OutputFormat::NormalMessage);
|
emit addOutput(tr("Removing directory %1").arg(dir), OutputFormat::NormalMessage);
|
||||||
if (!FileUtils::removeRecursively(androidDir, &error)) {
|
if (!FileUtils::removeRecursively(androidDir, &error)) {
|
||||||
|
@@ -223,7 +223,7 @@ private:
|
|||||||
AndroidSdkManager &m_sdkManager;
|
AndroidSdkManager &m_sdkManager;
|
||||||
const AndroidConfig &m_config;
|
const AndroidConfig &m_config;
|
||||||
AndroidSdkPackageList m_allPackages;
|
AndroidSdkPackageList m_allPackages;
|
||||||
FileName lastSdkManagerPath;
|
FilePath lastSdkManagerPath;
|
||||||
QString m_licenseTextCache;
|
QString m_licenseTextCache;
|
||||||
QByteArray m_licenseUserInput;
|
QByteArray m_licenseUserInput;
|
||||||
mutable QReadWriteLock m_licenseInputLock;
|
mutable QReadWriteLock m_licenseInputLock;
|
||||||
@@ -243,7 +243,7 @@ class SdkManagerOutputParser
|
|||||||
QStringList headerParts;
|
QStringList headerParts;
|
||||||
QVersionNumber revision;
|
QVersionNumber revision;
|
||||||
QString description;
|
QString description;
|
||||||
Utils::FileName installedLocation;
|
Utils::FilePath installedLocation;
|
||||||
QMap<QString, QString> extraData;
|
QMap<QString, QString> extraData;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -612,7 +612,7 @@ bool SdkManagerOutputParser::parseAbstractData(SdkManagerOutputParser::GenericPa
|
|||||||
for (const auto &key: qAsConst(extraKeys)) {
|
for (const auto &key: qAsConst(extraKeys)) {
|
||||||
if (valueForKey(key, line, &value)) {
|
if (valueForKey(key, line, &value)) {
|
||||||
if (key == installLocationKey)
|
if (key == installLocationKey)
|
||||||
output.installedLocation = Utils::FileName::fromString(value);
|
output.installedLocation = Utils::FilePath::fromString(value);
|
||||||
else if (key == revisionKey)
|
else if (key == revisionKey)
|
||||||
output.revision = QVersionNumber::fromString(value);
|
output.revision = QVersionNumber::fromString(value);
|
||||||
else if (key == descriptionKey)
|
else if (key == descriptionKey)
|
||||||
|
@@ -69,7 +69,7 @@ const QString &AndroidSdkPackage::sdkStylePath() const
|
|||||||
return m_sdkStylePath;
|
return m_sdkStylePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Utils::FileName &AndroidSdkPackage::installedLocation() const
|
const Utils::FilePath &AndroidSdkPackage::installedLocation() const
|
||||||
{
|
{
|
||||||
return m_installedLocation;
|
return m_installedLocation;
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ void AndroidSdkPackage::setState(AndroidSdkPackage::PackageState state)
|
|||||||
m_state = state;
|
m_state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidSdkPackage::setInstalledLocation(const Utils::FileName &path)
|
void AndroidSdkPackage::setInstalledLocation(const Utils::FilePath &path)
|
||||||
{
|
{
|
||||||
m_installedLocation = path;
|
m_installedLocation = path;
|
||||||
if (m_installedLocation.exists())
|
if (m_installedLocation.exists())
|
||||||
|
@@ -77,13 +77,13 @@ public:
|
|||||||
const QVersionNumber &revision() const;
|
const QVersionNumber &revision() const;
|
||||||
PackageState state() const;
|
PackageState state() const;
|
||||||
const QString &sdkStylePath() const;
|
const QString &sdkStylePath() const;
|
||||||
const Utils::FileName &installedLocation() const;
|
const Utils::FilePath &installedLocation() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setDisplayText(const QString &str);
|
void setDisplayText(const QString &str);
|
||||||
void setDescriptionText(const QString &str);
|
void setDescriptionText(const QString &str);
|
||||||
void setState(PackageState state);
|
void setState(PackageState state);
|
||||||
void setInstalledLocation(const Utils::FileName &path);
|
void setInstalledLocation(const Utils::FilePath &path);
|
||||||
|
|
||||||
virtual void updatePackageDetails();
|
virtual void updatePackageDetails();
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ private:
|
|||||||
QVersionNumber m_revision;
|
QVersionNumber m_revision;
|
||||||
PackageState m_state = PackageState::Unknown;
|
PackageState m_state = PackageState::Unknown;
|
||||||
QString m_sdkStylePath;
|
QString m_sdkStylePath;
|
||||||
Utils::FileName m_installedLocation;
|
Utils::FilePath m_installedLocation;
|
||||||
|
|
||||||
friend class Internal::SdkManagerOutputParser;
|
friend class Internal::SdkManagerOutputParser;
|
||||||
friend class Internal::AndroidToolOutputParser;
|
friend class Internal::AndroidToolOutputParser;
|
||||||
|
@@ -371,28 +371,28 @@ void AndroidSettingsWidget::saveSettings()
|
|||||||
|
|
||||||
void AndroidSettingsWidget::validateJdk()
|
void AndroidSettingsWidget::validateJdk()
|
||||||
{
|
{
|
||||||
auto javaPath = Utils::FileName::fromUserInput(m_ui->OpenJDKLocationPathChooser->rawPath());
|
auto javaPath = Utils::FilePath::fromUserInput(m_ui->OpenJDKLocationPathChooser->rawPath());
|
||||||
m_androidConfig.setOpenJDKLocation(javaPath);
|
m_androidConfig.setOpenJDKLocation(javaPath);
|
||||||
bool jdkPathExists = m_androidConfig.openJDKLocation().exists();
|
bool jdkPathExists = m_androidConfig.openJDKLocation().exists();
|
||||||
auto summaryWidget = static_cast<SummaryWidget *>(m_ui->javaDetailsWidget->widget());
|
auto summaryWidget = static_cast<SummaryWidget *>(m_ui->javaDetailsWidget->widget());
|
||||||
summaryWidget->setPointValid(JavaPathExistsRow, jdkPathExists);
|
summaryWidget->setPointValid(JavaPathExistsRow, jdkPathExists);
|
||||||
|
|
||||||
const Utils::FileName bin = m_androidConfig.openJDKLocation().pathAppended("bin/javac" QTC_HOST_EXE_SUFFIX);
|
const Utils::FilePath bin = m_androidConfig.openJDKLocation().pathAppended("bin/javac" QTC_HOST_EXE_SUFFIX);
|
||||||
summaryWidget->setPointValid(JavaJdkValidRow, jdkPathExists && bin.exists());
|
summaryWidget->setPointValid(JavaJdkValidRow, jdkPathExists && bin.exists());
|
||||||
updateUI();
|
updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidSettingsWidget::validateNdk()
|
void AndroidSettingsWidget::validateNdk()
|
||||||
{
|
{
|
||||||
auto ndkPath = Utils::FileName::fromUserInput(m_ui->NDKLocationPathChooser->rawPath());
|
auto ndkPath = Utils::FilePath::fromUserInput(m_ui->NDKLocationPathChooser->rawPath());
|
||||||
m_androidConfig.setNdkLocation(ndkPath);
|
m_androidConfig.setNdkLocation(ndkPath);
|
||||||
|
|
||||||
auto summaryWidget = static_cast<SummaryWidget *>(m_ui->androidDetailsWidget->widget());
|
auto summaryWidget = static_cast<SummaryWidget *>(m_ui->androidDetailsWidget->widget());
|
||||||
summaryWidget->setPointValid(NdkPathExistsRow, m_androidConfig.ndkLocation().exists());
|
summaryWidget->setPointValid(NdkPathExistsRow, m_androidConfig.ndkLocation().exists());
|
||||||
|
|
||||||
const Utils::FileName ndkPlatformsDir = ndkPath.pathAppended("platforms");
|
const Utils::FilePath ndkPlatformsDir = ndkPath.pathAppended("platforms");
|
||||||
const Utils::FileName ndkToolChainsDir = ndkPath.pathAppended("toolchains");
|
const Utils::FilePath ndkToolChainsDir = ndkPath.pathAppended("toolchains");
|
||||||
const Utils::FileName ndkSourcesDir = ndkPath.pathAppended("sources/cxx-stl");
|
const Utils::FilePath ndkSourcesDir = ndkPath.pathAppended("sources/cxx-stl");
|
||||||
summaryWidget->setPointValid(NdkDirStructureRow,
|
summaryWidget->setPointValid(NdkDirStructureRow,
|
||||||
ndkPlatformsDir.exists()
|
ndkPlatformsDir.exists()
|
||||||
&& ndkToolChainsDir.exists()
|
&& ndkToolChainsDir.exists()
|
||||||
@@ -405,7 +405,7 @@ void AndroidSettingsWidget::validateNdk()
|
|||||||
|
|
||||||
void AndroidSettingsWidget::onSdkPathChanged()
|
void AndroidSettingsWidget::onSdkPathChanged()
|
||||||
{
|
{
|
||||||
auto sdkPath = Utils::FileName::fromUserInput(m_ui->SDKLocationPathChooser->rawPath());
|
auto sdkPath = Utils::FilePath::fromUserInput(m_ui->SDKLocationPathChooser->rawPath());
|
||||||
m_androidConfig.setSdkLocation(sdkPath);
|
m_androidConfig.setSdkLocation(sdkPath);
|
||||||
// Package reload will trigger validateSdk.
|
// Package reload will trigger validateSdk.
|
||||||
m_sdkManager->reloadPackages();
|
m_sdkManager->reloadPackages();
|
||||||
|
@@ -60,7 +60,7 @@ static const QHash<QString, Abi> ClangTargets = {
|
|||||||
static const QList<Core::Id> LanguageIds = {ProjectExplorer::Constants::CXX_LANGUAGE_ID,
|
static const QList<Core::Id> LanguageIds = {ProjectExplorer::Constants::CXX_LANGUAGE_ID,
|
||||||
ProjectExplorer::Constants::C_LANGUAGE_ID};
|
ProjectExplorer::Constants::C_LANGUAGE_ID};
|
||||||
|
|
||||||
static ToolChain *findToolChain(Utils::FileName &compilerPath, Core::Id lang, const QString &target,
|
static ToolChain *findToolChain(Utils::FilePath &compilerPath, Core::Id lang, const QString &target,
|
||||||
CToolChainList &alreadyKnown)
|
CToolChainList &alreadyKnown)
|
||||||
{
|
{
|
||||||
ToolChain * tc = Utils::findOrDefault(alreadyKnown, [target, compilerPath, lang](ToolChain *tc) {
|
ToolChain * tc = Utils::findOrDefault(alreadyKnown, [target, compilerPath, lang](ToolChain *tc) {
|
||||||
@@ -92,11 +92,11 @@ void AndroidToolChain::addToEnvironment(Environment &env) const
|
|||||||
{
|
{
|
||||||
env.set(QLatin1String("ANDROID_NDK_HOST"),
|
env.set(QLatin1String("ANDROID_NDK_HOST"),
|
||||||
AndroidConfigurations::currentConfig().toolchainHost());
|
AndroidConfigurations::currentConfig().toolchainHost());
|
||||||
const Utils::FileName javaHome = AndroidConfigurations::currentConfig().openJDKLocation();
|
const Utils::FilePath javaHome = AndroidConfigurations::currentConfig().openJDKLocation();
|
||||||
if (!javaHome.exists()) {
|
if (!javaHome.exists()) {
|
||||||
env.set(QLatin1String("JAVA_HOME"), javaHome.toString());
|
env.set(QLatin1String("JAVA_HOME"), javaHome.toString());
|
||||||
const FileName javaBin = javaHome.pathAppended("bin");
|
const FilePath javaBin = javaHome.pathAppended("bin");
|
||||||
if (!Utils::contains(env.path(), [&javaBin](const Utils::FileName &p) { return p == javaBin; }))
|
if (!Utils::contains(env.path(), [&javaBin](const Utils::FilePath &p) { return p == javaBin; }))
|
||||||
env.prependOrSetPath(javaBin.toUserOutput());
|
env.prependOrSetPath(javaBin.toUserOutput());
|
||||||
}
|
}
|
||||||
env.set(QLatin1String("ANDROID_HOME"),
|
env.set(QLatin1String("ANDROID_HOME"),
|
||||||
@@ -105,13 +105,13 @@ void AndroidToolChain::addToEnvironment(Environment &env) const
|
|||||||
AndroidConfigurations::currentConfig().sdkLocation().toString());
|
AndroidConfigurations::currentConfig().sdkLocation().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidToolChain::suggestedDebugger() const
|
FilePath AndroidToolChain::suggestedDebugger() const
|
||||||
{
|
{
|
||||||
// TODO: Make use of LLDB if available.
|
// TODO: Make use of LLDB if available.
|
||||||
return AndroidConfigurations::currentConfig().gdbPath(targetAbi());
|
return AndroidConfigurations::currentConfig().gdbPath(targetAbi());
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidToolChain::suggestedGdbServer() const
|
FilePath AndroidToolChain::suggestedGdbServer() const
|
||||||
{
|
{
|
||||||
return AndroidConfigurations::currentConfig().gdbServer(targetAbi());
|
return AndroidConfigurations::currentConfig().gdbServer(targetAbi());
|
||||||
}
|
}
|
||||||
@@ -128,11 +128,11 @@ QStringList AndroidToolChain::suggestedMkspecList() const
|
|||||||
return {"android-g++", "android-clang"};
|
return {"android-g++", "android-clang"};
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName AndroidToolChain::makeCommand(const Environment &env) const
|
FilePath AndroidToolChain::makeCommand(const Environment &env) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(env);
|
Q_UNUSED(env);
|
||||||
FileName makePath = AndroidConfigurations::currentConfig().makePath();
|
FilePath makePath = AndroidConfigurations::currentConfig().makePath();
|
||||||
return makePath.exists() ? makePath : FileName::fromString("make");
|
return makePath.exists() ? makePath : FilePath::fromString("make");
|
||||||
}
|
}
|
||||||
|
|
||||||
GccToolChain::DetectedAbisResult AndroidToolChain::detectSupportedAbis() const
|
GccToolChain::DetectedAbisResult AndroidToolChain::detectSupportedAbis() const
|
||||||
@@ -162,7 +162,7 @@ ToolChainList AndroidToolChainFactory::autoDetect(CToolChainList &alreadyKnown)
|
|||||||
return autodetectToolChainsForNdk(alreadyKnown);
|
return autodetectToolChainsForNdk(alreadyKnown);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FileName clangPlusPlusPath(const FileName &clangPath)
|
static FilePath clangPlusPlusPath(const FilePath &clangPath)
|
||||||
{
|
{
|
||||||
return clangPath.parentDir().pathAppended(
|
return clangPath.parentDir().pathAppended(
|
||||||
HostOsInfo::withExecutableSuffix(
|
HostOsInfo::withExecutableSuffix(
|
||||||
@@ -172,7 +172,7 @@ static FileName clangPlusPlusPath(const FileName &clangPath)
|
|||||||
ToolChainList AndroidToolChainFactory::autodetectToolChainsForNdk(CToolChainList &alreadyKnown)
|
ToolChainList AndroidToolChainFactory::autodetectToolChainsForNdk(CToolChainList &alreadyKnown)
|
||||||
{
|
{
|
||||||
QList<ToolChain *> result;
|
QList<ToolChain *> result;
|
||||||
FileName clangPath = AndroidConfigurations::currentConfig().clangPath();
|
FilePath clangPath = AndroidConfigurations::currentConfig().clangPath();
|
||||||
if (!clangPath.exists()) {
|
if (!clangPath.exists()) {
|
||||||
qCDebug(androidTCLog) << "Clang toolchains detection fails. Can not find Clang"<< clangPath;
|
qCDebug(androidTCLog) << "Clang toolchains detection fails. Can not find Clang"<< clangPath;
|
||||||
return result;
|
return result;
|
||||||
@@ -182,7 +182,7 @@ ToolChainList AndroidToolChainFactory::autodetectToolChainsForNdk(CToolChainList
|
|||||||
<< AndroidConfigurations::currentConfig().ndkLocation();
|
<< AndroidConfigurations::currentConfig().ndkLocation();
|
||||||
|
|
||||||
for (const Core::Id &lang : LanguageIds) {
|
for (const Core::Id &lang : LanguageIds) {
|
||||||
FileName compilerCommand = clangPath;
|
FilePath compilerCommand = clangPath;
|
||||||
if (lang == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
|
if (lang == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
|
||||||
compilerCommand = clangPlusPlusPath(clangPath);
|
compilerCommand = clangPlusPlusPath(clangPath);
|
||||||
|
|
||||||
|
@@ -42,10 +42,10 @@ public:
|
|||||||
bool isValid() const override;
|
bool isValid() const override;
|
||||||
void addToEnvironment(Utils::Environment &env) const override;
|
void addToEnvironment(Utils::Environment &env) const override;
|
||||||
|
|
||||||
Utils::FileName suggestedDebugger() const override;
|
Utils::FilePath suggestedDebugger() const override;
|
||||||
Utils::FileName suggestedGdbServer() const;
|
Utils::FilePath suggestedGdbServer() const;
|
||||||
QStringList suggestedMkspecList() const override;
|
QStringList suggestedMkspecList() const override;
|
||||||
Utils::FileName makeCommand(const Utils::Environment &environment) const override;
|
Utils::FilePath makeCommand(const Utils::Environment &environment) const override;
|
||||||
bool fromMap(const QVariantMap &data) override;
|
bool fromMap(const QVariantMap &data) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Core::Id language;
|
Core::Id language;
|
||||||
Utils::FileName compilerCommand;
|
Utils::FilePath compilerCommand;
|
||||||
ProjectExplorer::Abi abi;
|
ProjectExplorer::Abi abi;
|
||||||
QString version;
|
QString version;
|
||||||
};
|
};
|
||||||
|
@@ -46,7 +46,7 @@ using namespace Utils;
|
|||||||
class AndroidToolOutputParser
|
class AndroidToolOutputParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void parseTargetListing(const QString &output, const FileName &sdkLocation,
|
void parseTargetListing(const QString &output, const FilePath &sdkLocation,
|
||||||
SdkPlatformList &platformList);
|
SdkPlatformList &platformList);
|
||||||
|
|
||||||
QList<SdkPlatform> m_installedPlatforms;
|
QList<SdkPlatform> m_installedPlatforms;
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
environment. Returns \c true for successful execution. Command's output is copied to \a
|
environment. Returns \c true for successful execution. Command's output is copied to \a
|
||||||
output.
|
output.
|
||||||
*/
|
*/
|
||||||
static bool androidToolCommand(Utils::FileName toolPath, const QStringList &args,
|
static bool androidToolCommand(Utils::FilePath toolPath, const QStringList &args,
|
||||||
const QProcessEnvironment &environment, QString *output)
|
const QProcessEnvironment &environment, QString *output)
|
||||||
{
|
{
|
||||||
QString androidToolPath = toolPath.toString();
|
QString androidToolPath = toolPath.toString();
|
||||||
@@ -143,7 +143,7 @@ QFuture<AndroidDeviceInfoList> AndroidToolManager::androidVirtualDevicesFuture()
|
|||||||
AndroidConfigurations::toolsEnvironment(m_config));
|
AndroidConfigurations::toolsEnvironment(m_config));
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateAvdInfo AndroidToolManager::createAvdImpl(CreateAvdInfo info, FileName androidToolPath,
|
CreateAvdInfo AndroidToolManager::createAvdImpl(CreateAvdInfo info, FilePath androidToolPath,
|
||||||
QProcessEnvironment env)
|
QProcessEnvironment env)
|
||||||
{
|
{
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
@@ -195,8 +195,8 @@ CreateAvdInfo AndroidToolManager::createAvdImpl(CreateAvdInfo info, FileName and
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidDeviceInfoList AndroidToolManager::androidVirtualDevices(const Utils::FileName &androidTool,
|
AndroidDeviceInfoList AndroidToolManager::androidVirtualDevices(const Utils::FilePath &androidTool,
|
||||||
const FileName &sdkLocationPath,
|
const FilePath &sdkLocationPath,
|
||||||
const QProcessEnvironment &env)
|
const QProcessEnvironment &env)
|
||||||
{
|
{
|
||||||
AndroidDeviceInfoList devices;
|
AndroidDeviceInfoList devices;
|
||||||
@@ -274,7 +274,7 @@ AndroidDeviceInfoList AndroidToolManager::androidVirtualDevices(const Utils::Fil
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AndroidToolOutputParser::parseTargetListing(const QString &output,
|
void AndroidToolOutputParser::parseTargetListing(const QString &output,
|
||||||
const Utils::FileName &sdkLocation,
|
const Utils::FilePath &sdkLocation,
|
||||||
SdkPlatformList &platformList)
|
SdkPlatformList &platformList)
|
||||||
{
|
{
|
||||||
auto addSystemImage = [](const QStringList& abiList, SdkPlatform *platform) {
|
auto addSystemImage = [](const QStringList& abiList, SdkPlatform *platform) {
|
||||||
@@ -291,7 +291,7 @@ void AndroidToolOutputParser::parseTargetListing(const QString &output,
|
|||||||
QVersionNumber revision;
|
QVersionNumber revision;
|
||||||
int apiLevel = -1;
|
int apiLevel = -1;
|
||||||
QString description;
|
QString description;
|
||||||
Utils::FileName installedLocation;
|
Utils::FilePath installedLocation;
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
abiList.clear();
|
abiList.clear();
|
||||||
|
@@ -58,10 +58,10 @@ public:
|
|||||||
|
|
||||||
// Helper methods
|
// Helper methods
|
||||||
private:
|
private:
|
||||||
static CreateAvdInfo createAvdImpl(CreateAvdInfo info, Utils::FileName androidToolPath,
|
static CreateAvdInfo createAvdImpl(CreateAvdInfo info, Utils::FilePath androidToolPath,
|
||||||
QProcessEnvironment env);
|
QProcessEnvironment env);
|
||||||
static AndroidDeviceInfoList androidVirtualDevices(const Utils::FileName &androidTool,
|
static AndroidDeviceInfoList androidVirtualDevices(const Utils::FilePath &androidTool,
|
||||||
const Utils::FileName &sdkLlocationPath,
|
const Utils::FilePath &sdkLlocationPath,
|
||||||
const QProcessEnvironment &env);
|
const QProcessEnvironment &env);
|
||||||
private:
|
private:
|
||||||
const AndroidConfig &m_config;
|
const AndroidConfig &m_config;
|
||||||
|
@@ -324,22 +324,22 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
|||||||
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
|
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
|
||||||
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX")
|
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX")
|
||||||
.append(QLatin1String("/src/android/java/AndroidManifest.xml")));
|
.append(QLatin1String("/src/android/java/AndroidManifest.xml")));
|
||||||
FileUtils::copyRecursively(FileName::fromString(src),
|
FileUtils::copyRecursively(FilePath::fromString(src),
|
||||||
FileName::fromString(m_directory + QLatin1String("/AndroidManifest.xml")),
|
FilePath::fromString(m_directory + QLatin1String("/AndroidManifest.xml")),
|
||||||
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
||||||
} else {
|
} else {
|
||||||
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX")
|
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX")
|
||||||
.append(QLatin1String("/src/android/templates")));
|
.append(QLatin1String("/src/android/templates")));
|
||||||
|
|
||||||
FileUtils::copyRecursively(FileName::fromString(src),
|
FileUtils::copyRecursively(FilePath::fromString(src),
|
||||||
FileName::fromString(m_directory),
|
FilePath::fromString(m_directory),
|
||||||
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
||||||
|
|
||||||
if (m_copyGradle) {
|
if (m_copyGradle) {
|
||||||
FileName gradlePath = FileName::fromString(version->qmakeProperty("QT_INSTALL_PREFIX").append(QLatin1String("/src/3rdparty/gradle")));
|
FilePath gradlePath = FilePath::fromString(version->qmakeProperty("QT_INSTALL_PREFIX").append(QLatin1String("/src/3rdparty/gradle")));
|
||||||
if (!gradlePath.exists())
|
if (!gradlePath.exists())
|
||||||
gradlePath = AndroidConfigurations::currentConfig().sdkLocation().pathAppended("/tools/templates/gradle/wrapper");
|
gradlePath = AndroidConfigurations::currentConfig().sdkLocation().pathAppended("/tools/templates/gradle/wrapper");
|
||||||
FileUtils::copyRecursively(gradlePath, FileName::fromString(m_directory),
|
FileUtils::copyRecursively(gradlePath, FilePath::fromString(m_directory),
|
||||||
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,12 +53,12 @@ void JavaParser::setProjectFileList(const QStringList &fileList)
|
|||||||
m_fileList = fileList;
|
m_fileList = fileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JavaParser::setBuildDirectory(const Utils::FileName &buildDirectory)
|
void JavaParser::setBuildDirectory(const Utils::FilePath &buildDirectory)
|
||||||
{
|
{
|
||||||
m_buildDirectory = buildDirectory;
|
m_buildDirectory = buildDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JavaParser::setSourceDirectory(const Utils::FileName &sourceDirectory)
|
void JavaParser::setSourceDirectory(const Utils::FilePath &sourceDirectory)
|
||||||
{
|
{
|
||||||
m_sourceDirectory = sourceDirectory;
|
m_sourceDirectory = sourceDirectory;
|
||||||
}
|
}
|
||||||
@@ -70,16 +70,16 @@ void JavaParser::parse(const QString &line)
|
|||||||
int lineno = m_javaRegExp.cap(3).toInt(&ok);
|
int lineno = m_javaRegExp.cap(3).toInt(&ok);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
lineno = -1;
|
lineno = -1;
|
||||||
Utils::FileName file = Utils::FileName::fromUserInput(m_javaRegExp.cap(2));
|
Utils::FilePath file = Utils::FilePath::fromUserInput(m_javaRegExp.cap(2));
|
||||||
if (file.isChildOf(m_buildDirectory)) {
|
if (file.isChildOf(m_buildDirectory)) {
|
||||||
Utils::FileName relativePath = file.relativeChildPath(m_buildDirectory);
|
Utils::FilePath relativePath = file.relativeChildPath(m_buildDirectory);
|
||||||
file = m_sourceDirectory.pathAppended(relativePath.toString());
|
file = m_sourceDirectory.pathAppended(relativePath.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.toFileInfo().isRelative()) {
|
if (file.toFileInfo().isRelative()) {
|
||||||
for (int i = 0; i < m_fileList.size(); i++)
|
for (int i = 0; i < m_fileList.size(); i++)
|
||||||
if (m_fileList[i].endsWith(file.toString())) {
|
if (m_fileList[i].endsWith(file.toString())) {
|
||||||
file = Utils::FileName::fromString(m_fileList[i]);
|
file = Utils::FilePath::fromString(m_fileList[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -43,16 +43,16 @@ public:
|
|||||||
void stdError(const QString &line) override;
|
void stdError(const QString &line) override;
|
||||||
void setProjectFileList(const QStringList &fileList);
|
void setProjectFileList(const QStringList &fileList);
|
||||||
|
|
||||||
void setBuildDirectory(const Utils::FileName &buildDirectory);
|
void setBuildDirectory(const Utils::FilePath &buildDirectory);
|
||||||
void setSourceDirectory(const Utils::FileName &sourceDirectory);
|
void setSourceDirectory(const Utils::FilePath &sourceDirectory);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parse(const QString &line);
|
void parse(const QString &line);
|
||||||
|
|
||||||
QRegExp m_javaRegExp;
|
QRegExp m_javaRegExp;
|
||||||
QStringList m_fileList;
|
QStringList m_fileList;
|
||||||
Utils::FileName m_sourceDirectory;
|
Utils::FilePath m_sourceDirectory;
|
||||||
Utils::FileName m_buildDirectory;
|
Utils::FilePath m_buildDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -250,7 +250,7 @@ void AutotestPlugin::onRunFileTriggered()
|
|||||||
if (!document)
|
if (!document)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const Utils::FileName &fileName = document->filePath();
|
const Utils::FilePath &fileName = document->filePath();
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -285,7 +285,7 @@ QList<TestConfiguration *> GTestTreeItem::getSelectedTestConfigurations() const
|
|||||||
return getTestConfigurations(false);
|
return getTestConfigurations(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<TestConfiguration *> GTestTreeItem::getTestConfigurationsForFile(const Utils::FileName &fileName) const
|
QList<TestConfiguration *> GTestTreeItem::getTestConfigurationsForFile(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
QList<TestConfiguration *> result;
|
QList<TestConfiguration *> result;
|
||||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||||
|
@@ -57,7 +57,7 @@ public:
|
|||||||
TestConfiguration *debugConfiguration() const override;
|
TestConfiguration *debugConfiguration() const override;
|
||||||
QList<TestConfiguration *> getAllTestConfigurations() const override;
|
QList<TestConfiguration *> getAllTestConfigurations() const override;
|
||||||
QList<TestConfiguration *> getSelectedTestConfigurations() const override;
|
QList<TestConfiguration *> getSelectedTestConfigurations() const override;
|
||||||
QList<TestConfiguration *> getTestConfigurationsForFile(const Utils::FileName &fileName) const override;
|
QList<TestConfiguration *> getTestConfigurationsForFile(const Utils::FilePath &fileName) const override;
|
||||||
TestTreeItem *find(const TestParseResult *result) override;
|
TestTreeItem *find(const TestParseResult *result) override;
|
||||||
TestTreeItem *findChild(const TestTreeItem *other) override;
|
TestTreeItem *findChild(const TestTreeItem *other) override;
|
||||||
bool modify(const TestParseResult *result) override;
|
bool modify(const TestParseResult *result) override;
|
||||||
|
@@ -234,7 +234,7 @@ QList<TestConfiguration *> QtTestTreeItem::getSelectedTestConfigurations() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<TestConfiguration *> QtTestTreeItem::getTestConfigurationsForFile(const Utils::FileName &fileName) const
|
QList<TestConfiguration *> QtTestTreeItem::getTestConfigurationsForFile(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
QList<TestConfiguration *> result;
|
QList<TestConfiguration *> result;
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ public:
|
|||||||
TestConfiguration *debugConfiguration() const override;
|
TestConfiguration *debugConfiguration() const override;
|
||||||
QList<TestConfiguration *> getAllTestConfigurations() const override;
|
QList<TestConfiguration *> getAllTestConfigurations() const override;
|
||||||
QList<TestConfiguration *> getSelectedTestConfigurations() const override;
|
QList<TestConfiguration *> getSelectedTestConfigurations() const override;
|
||||||
QList<TestConfiguration *> getTestConfigurationsForFile(const Utils::FileName &fileName) const override;
|
QList<TestConfiguration *> getTestConfigurationsForFile(const Utils::FilePath &fileName) const override;
|
||||||
TestTreeItem *find(const TestParseResult *result) override;
|
TestTreeItem *find(const TestParseResult *result) override;
|
||||||
TestTreeItem *findChild(const TestTreeItem *other) override;
|
TestTreeItem *findChild(const TestTreeItem *other) override;
|
||||||
bool modify(const TestParseResult *result) override;
|
bool modify(const TestParseResult *result) override;
|
||||||
|
@@ -144,7 +144,7 @@ QList<QmlJS::Document::Ptr> QuickTestParser::scanDirectoryForQuickTestQmlFiles(c
|
|||||||
// make sure even files not listed in pro file are available inside the snapshot
|
// make sure even files not listed in pro file are available inside the snapshot
|
||||||
QFutureInterface<void> future;
|
QFutureInterface<void> future;
|
||||||
QmlJS::PathsAndLanguages paths;
|
QmlJS::PathsAndLanguages paths;
|
||||||
paths.maybeInsert(Utils::FileName::fromString(srcDir), QmlJS::Dialect::Qml);
|
paths.maybeInsert(Utils::FilePath::fromString(srcDir), QmlJS::Dialect::Qml);
|
||||||
QmlJS::ModelManagerInterface::importScan(future, qmlJsMM->workingCopy(), paths, qmlJsMM,
|
QmlJS::ModelManagerInterface::importScan(future, qmlJsMM->workingCopy(), paths, qmlJsMM,
|
||||||
false /*emitDocumentChanges*/, false /*onlyTheLib*/, true /*forceRescan*/ );
|
false /*emitDocumentChanges*/, false /*onlyTheLib*/, true /*forceRescan*/ );
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ void QuickTestParser::handleDirectoryChanged(const QString &directory)
|
|||||||
});
|
});
|
||||||
if (timestampChanged) {
|
if (timestampChanged) {
|
||||||
QmlJS::PathsAndLanguages paths;
|
QmlJS::PathsAndLanguages paths;
|
||||||
paths.maybeInsert(Utils::FileName::fromString(directory), QmlJS::Dialect::Qml);
|
paths.maybeInsert(Utils::FilePath::fromString(directory), QmlJS::Dialect::Qml);
|
||||||
QFutureInterface<void> future;
|
QFutureInterface<void> future;
|
||||||
QmlJS::ModelManagerInterface *qmlJsMM = QmlJS::ModelManagerInterface::instance();
|
QmlJS::ModelManagerInterface *qmlJsMM = QmlJS::ModelManagerInterface::instance();
|
||||||
QmlJS::ModelManagerInterface::importScan(future, qmlJsMM->workingCopy(), paths, qmlJsMM,
|
QmlJS::ModelManagerInterface::importScan(future, qmlJsMM->workingCopy(), paths, qmlJsMM,
|
||||||
|
@@ -280,7 +280,7 @@ QList<TestConfiguration *> QuickTestTreeItem::getSelectedTestConfigurations() co
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<TestConfiguration *> QuickTestTreeItem::getTestConfigurationsForFile(const Utils::FileName &fileName) const
|
QList<TestConfiguration *> QuickTestTreeItem::getTestConfigurationsForFile(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
QList<TestConfiguration *> result;
|
QList<TestConfiguration *> result;
|
||||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||||
|
@@ -45,7 +45,7 @@ public:
|
|||||||
TestConfiguration *debugConfiguration() const override;
|
TestConfiguration *debugConfiguration() const override;
|
||||||
QList<TestConfiguration *> getAllTestConfigurations() const override;
|
QList<TestConfiguration *> getAllTestConfigurations() const override;
|
||||||
QList<TestConfiguration *> getSelectedTestConfigurations() const override;
|
QList<TestConfiguration *> getSelectedTestConfigurations() const override;
|
||||||
QList<TestConfiguration *> getTestConfigurationsForFile(const Utils::FileName &fileName) const override;
|
QList<TestConfiguration *> getTestConfigurationsForFile(const Utils::FilePath &fileName) const override;
|
||||||
TestTreeItem *find(const TestParseResult *result) override;
|
TestTreeItem *find(const TestParseResult *result) override;
|
||||||
TestTreeItem *findChild(const TestTreeItem *other) override;
|
TestTreeItem *findChild(const TestTreeItem *other) override;
|
||||||
bool modify(const TestParseResult *result) override;
|
bool modify(const TestParseResult *result) override;
|
||||||
|
@@ -186,7 +186,7 @@ void TestCodeParser::onDocumentUpdated(const QString &fileName, bool isQmlFile)
|
|||||||
if (!project)
|
if (!project)
|
||||||
return;
|
return;
|
||||||
// Quick tests: qml files aren't necessarily listed inside project files
|
// Quick tests: qml files aren't necessarily listed inside project files
|
||||||
if (!isQmlFile && !project->isKnownFile(Utils::FileName::fromString(fileName)))
|
if (!isQmlFile && !project->isKnownFile(Utils::FilePath::fromString(fileName)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scanForTests(QStringList(fileName));
|
scanForTests(QStringList(fileName));
|
||||||
@@ -321,7 +321,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList, ITestParser *pars
|
|||||||
return;
|
return;
|
||||||
QStringList list;
|
QStringList list;
|
||||||
if (isFullParse) {
|
if (isFullParse) {
|
||||||
list = Utils::transform(project->files(Project::SourceFiles), &Utils::FileName::toString);
|
list = Utils::transform(project->files(Project::SourceFiles), &Utils::FilePath::toString);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
// at least project file should be there, but might happen if parsing current project
|
// at least project file should be there, but might happen if parsing current project
|
||||||
// takes too long, especially when opening sessions holding multiple projects
|
// takes too long, especially when opening sessions holding multiple projects
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
TestEditorMark::TestEditorMark(QPersistentModelIndex item, const Utils::FileName &file, int line)
|
TestEditorMark::TestEditorMark(QPersistentModelIndex item, const Utils::FilePath &file, int line)
|
||||||
: TextEditor::TextMark(file, line, Core::Id(Constants::TASK_MARK_ID)),
|
: TextEditor::TextMark(file, line, Core::Id(Constants::TASK_MARK_ID)),
|
||||||
m_item(item)
|
m_item(item)
|
||||||
{
|
{
|
||||||
|
@@ -35,7 +35,7 @@ namespace Internal {
|
|||||||
class TestEditorMark : public TextEditor::TextMark
|
class TestEditorMark : public TextEditor::TextMark
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TestEditorMark(QPersistentModelIndex item, const Utils::FileName &file, int line);
|
TestEditorMark(QPersistentModelIndex item, const Utils::FilePath &file, int line);
|
||||||
|
|
||||||
bool isClickable() const override { return true; }
|
bool isClickable() const override { return true; }
|
||||||
void clicked() override;
|
void clicked() override;
|
||||||
|
@@ -671,7 +671,7 @@ void TestResultsPane::createMarks(const QModelIndex &parent)
|
|||||||
bool isLocationItem = result->result() == ResultType::MessageLocation;
|
bool isLocationItem = result->result() == ResultType::MessageLocation;
|
||||||
if (interested.contains(result->result())
|
if (interested.contains(result->result())
|
||||||
|| (isLocationItem && interested.contains(parentType))) {
|
|| (isLocationItem && interested.contains(parentType))) {
|
||||||
const Utils::FileName fileName = Utils::FileName::fromString(result->fileName());
|
const Utils::FilePath fileName = Utils::FilePath::fromString(result->fileName());
|
||||||
TestEditorMark *mark = new TestEditorMark(index, fileName, result->line());
|
TestEditorMark *mark = new TestEditorMark(index, fileName, result->line());
|
||||||
mark->setIcon(index.data(Qt::DecorationRole).value<QIcon>());
|
mark->setIcon(index.data(Qt::DecorationRole).value<QIcon>());
|
||||||
mark->setColor(Utils::Theme::OutputPanes_TestFailTextColor);
|
mark->setColor(Utils::Theme::OutputPanes_TestFailTextColor);
|
||||||
|
@@ -259,7 +259,7 @@ QList<TestConfiguration *> TestTreeItem::getSelectedTestConfigurations() const
|
|||||||
return QList<TestConfiguration *>();
|
return QList<TestConfiguration *>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<TestConfiguration *> TestTreeItem::getTestConfigurationsForFile(const Utils::FileName &) const
|
QList<TestConfiguration *> TestTreeItem::getTestConfigurationsForFile(const Utils::FilePath &) const
|
||||||
{
|
{
|
||||||
return QList<TestConfiguration *>();
|
return QList<TestConfiguration *>();
|
||||||
}
|
}
|
||||||
@@ -368,9 +368,9 @@ QSet<QString> TestTreeItem::dependingInternalTargets(CppTools::CppModelManager *
|
|||||||
bool wasHeader;
|
bool wasHeader;
|
||||||
const QString correspondingFile
|
const QString correspondingFile
|
||||||
= CppTools::correspondingHeaderOrSource(file, &wasHeader, CppTools::CacheUsage::ReadOnly);
|
= CppTools::correspondingHeaderOrSource(file, &wasHeader, CppTools::CacheUsage::ReadOnly);
|
||||||
const Utils::FileNameList dependingFiles = snapshot.filesDependingOn(
|
const Utils::FilePathList dependingFiles = snapshot.filesDependingOn(
|
||||||
wasHeader ? file : correspondingFile);
|
wasHeader ? file : correspondingFile);
|
||||||
for (const Utils::FileName &fn : dependingFiles) {
|
for (const Utils::FilePath &fn : dependingFiles) {
|
||||||
for (const CppTools::ProjectPart::Ptr &part : cppMM->projectPart(fn))
|
for (const CppTools::ProjectPart::Ptr &part : cppMM->projectPart(fn))
|
||||||
result.insert(part->buildSystemTarget);
|
result.insert(part->buildSystemTarget);
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace CppTools { class CppModelManager; }
|
namespace CppTools { class CppModelManager; }
|
||||||
namespace Utils { class FileName; }
|
namespace Utils { class FilePath; }
|
||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
TestConfiguration *asConfiguration(TestRunMode mode) const;
|
TestConfiguration *asConfiguration(TestRunMode mode) const;
|
||||||
virtual QList<TestConfiguration *> getAllTestConfigurations() const;
|
virtual QList<TestConfiguration *> getAllTestConfigurations() const;
|
||||||
virtual QList<TestConfiguration *> getSelectedTestConfigurations() const;
|
virtual QList<TestConfiguration *> getSelectedTestConfigurations() const;
|
||||||
virtual QList<TestConfiguration *> getTestConfigurationsForFile(const Utils::FileName &fileName) const;
|
virtual QList<TestConfiguration *> getTestConfigurationsForFile(const Utils::FilePath &fileName) const;
|
||||||
virtual bool lessThan(const TestTreeItem *other, SortMode mode) const;
|
virtual bool lessThan(const TestTreeItem *other, SortMode mode) const;
|
||||||
virtual TestTreeItem *find(const TestParseResult *result) = 0;
|
virtual TestTreeItem *find(const TestParseResult *result) = 0;
|
||||||
virtual TestTreeItem *findChild(const TestTreeItem *other) = 0;
|
virtual TestTreeItem *findChild(const TestTreeItem *other) = 0;
|
||||||
|
@@ -158,7 +158,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<TestConfiguration *> TestTreeModel::getTestsForFile(const Utils::FileName &fileName) const
|
QList<TestConfiguration *> TestTreeModel::getTestsForFile(const Utils::FilePath &fileName) const
|
||||||
{
|
{
|
||||||
QList<TestConfiguration *> result;
|
QList<TestConfiguration *> result;
|
||||||
for (Utils::TreeItem *frameworkRoot : *rootItem())
|
for (Utils::TreeItem *frameworkRoot : *rootItem())
|
||||||
|
@@ -56,7 +56,7 @@ public:
|
|||||||
bool hasTests() const;
|
bool hasTests() const;
|
||||||
QList<TestConfiguration *> getAllTestCases() const;
|
QList<TestConfiguration *> getAllTestCases() const;
|
||||||
QList<TestConfiguration *> getSelectedTests() const;
|
QList<TestConfiguration *> getSelectedTests() const;
|
||||||
QList<TestConfiguration *> getTestsForFile(const Utils::FileName &fileName) const;
|
QList<TestConfiguration *> getTestsForFile(const Utils::FilePath &fileName) const;
|
||||||
QList<TestTreeItem *> testItemsByName(const QString &testName);
|
QList<TestTreeItem *> testItemsByName(const QString &testName);
|
||||||
void syncTestFrameworks();
|
void syncTestFrameworks();
|
||||||
void rebuild(const QList<Core::Id> &frameworkIds);
|
void rebuild(const QList<Core::Id> &frameworkIds);
|
||||||
|
@@ -78,7 +78,7 @@ bool AutogenStep::init()
|
|||||||
pp->setMacroExpander(bc->macroExpander());
|
pp->setMacroExpander(bc->macroExpander());
|
||||||
pp->setEnvironment(bc->environment());
|
pp->setEnvironment(bc->environment());
|
||||||
pp->setWorkingDirectory(bc->target()->project()->projectDirectory());
|
pp->setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||||
pp->setCommand(Utils::FileName::fromString("./autogen.sh"));
|
pp->setCommand(Utils::FilePath::fromString("./autogen.sh"));
|
||||||
pp->setArguments(m_additionalArgumentsAspect->value());
|
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||||
pp->resolveAll();
|
pp->resolveAll();
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ BuildStepConfigWidget *AutogenStep::createConfigWidget()
|
|||||||
param.setMacroExpander(bc->macroExpander());
|
param.setMacroExpander(bc->macroExpander());
|
||||||
param.setEnvironment(bc->environment());
|
param.setEnvironment(bc->environment());
|
||||||
param.setWorkingDirectory(bc->target()->project()->projectDirectory());
|
param.setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||||
param.setCommand(Utils::FileName::fromString("./autogen.sh"));
|
param.setCommand(Utils::FilePath::fromString("./autogen.sh"));
|
||||||
param.setArguments(m_additionalArgumentsAspect->value());
|
param.setArguments(m_additionalArgumentsAspect->value());
|
||||||
|
|
||||||
widget->setSummaryText(param.summary(displayName()));
|
widget->setSummaryText(param.summary(displayName()));
|
||||||
|
@@ -76,7 +76,7 @@ bool AutoreconfStep::init()
|
|||||||
pp->setMacroExpander(bc->macroExpander());
|
pp->setMacroExpander(bc->macroExpander());
|
||||||
pp->setEnvironment(bc->environment());
|
pp->setEnvironment(bc->environment());
|
||||||
pp->setWorkingDirectory(bc->target()->project()->projectDirectory());
|
pp->setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||||
pp->setCommand(Utils::FileName::fromString("autoreconf"));
|
pp->setCommand(Utils::FilePath::fromString("autoreconf"));
|
||||||
pp->setArguments(m_additionalArgumentsAspect->value());
|
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||||
pp->resolveAll();
|
pp->resolveAll();
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ BuildStepConfigWidget *AutoreconfStep::createConfigWidget()
|
|||||||
param.setMacroExpander(bc->macroExpander());
|
param.setMacroExpander(bc->macroExpander());
|
||||||
param.setEnvironment(bc->environment());
|
param.setEnvironment(bc->environment());
|
||||||
param.setWorkingDirectory(bc->target()->project()->projectDirectory());
|
param.setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||||
param.setCommand(Utils::FileName::fromString("autoreconf"));
|
param.setCommand(Utils::FilePath::fromString("autoreconf"));
|
||||||
param.setArguments(m_additionalArgumentsAspect->value());
|
param.setArguments(m_additionalArgumentsAspect->value());
|
||||||
|
|
||||||
widget->setSummaryText(param.summary(displayName()));
|
widget->setSummaryText(param.summary(displayName()));
|
||||||
|
@@ -58,7 +58,7 @@ AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(Target *parent, Core::I
|
|||||||
{
|
{
|
||||||
// /<foobar> is used so the un-changed check in setBuildDirectory() works correctly.
|
// /<foobar> is used so the un-changed check in setBuildDirectory() works correctly.
|
||||||
// The leading / is to avoid the relative the path expansion in BuildConfiguration::buildDirectory.
|
// The leading / is to avoid the relative the path expansion in BuildConfiguration::buildDirectory.
|
||||||
setBuildDirectory(Utils::FileName::fromString("/<foobar>"));
|
setBuildDirectory(Utils::FilePath::fromString("/<foobar>"));
|
||||||
setBuildDirectoryHistoryCompleter("AutoTools.BuildDir.History");
|
setBuildDirectoryHistoryCompleter("AutoTools.BuildDir.History");
|
||||||
setConfigWidgetDisplayName(tr("Autotools Manager"));
|
setConfigWidgetDisplayName(tr("Autotools Manager"));
|
||||||
}
|
}
|
||||||
@@ -116,14 +116,14 @@ QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableBuilds(const Targe
|
|||||||
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
{
|
{
|
||||||
const QString path = QFileInfo(projectPath).absolutePath();
|
const QString path = QFileInfo(projectPath).absolutePath();
|
||||||
BuildInfo info = createBuildInfo(k, Utils::FileName::fromString(path));
|
BuildInfo info = createBuildInfo(k, Utils::FilePath::fromString(path));
|
||||||
//: The name of the build configuration created by default for a autotools project.
|
//: The name of the build configuration created by default for a autotools project.
|
||||||
info.displayName = tr("Default");
|
info.displayName = tr("Default");
|
||||||
return {info};
|
return {info};
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildInfo AutotoolsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
BuildInfo AutotoolsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||||
const Utils::FileName &buildDir) const
|
const Utils::FilePath &buildDir) const
|
||||||
{
|
{
|
||||||
BuildInfo info(this);
|
BuildInfo info(this);
|
||||||
info.typeName = tr("Build");
|
info.typeName = tr("Build");
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
|
||||||
namespace Utils { class FileName; }
|
namespace Utils { class FilePath; }
|
||||||
|
|
||||||
namespace AutotoolsProjectManager {
|
namespace AutotoolsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -57,7 +57,7 @@ private:
|
|||||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
const QString &projectPath) const override;
|
const QString &projectPath) const override;
|
||||||
|
|
||||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FileName &buildDir) const;
|
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FilePath &buildDir) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -68,7 +68,7 @@ using namespace AutotoolsProjectManager;
|
|||||||
using namespace AutotoolsProjectManager::Internal;
|
using namespace AutotoolsProjectManager::Internal;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
AutotoolsProject::AutotoolsProject(const Utils::FileName &fileName) :
|
AutotoolsProject::AutotoolsProject(const Utils::FilePath &fileName) :
|
||||||
Project(Constants::MAKEFILE_MIMETYPE, fileName),
|
Project(Constants::MAKEFILE_MIMETYPE, fileName),
|
||||||
m_fileWatcher(new Utils::FileSystemWatcher(this)),
|
m_fileWatcher(new Utils::FileSystemWatcher(this)),
|
||||||
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater)
|
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater)
|
||||||
@@ -204,7 +204,7 @@ void AutotoolsProject::makefileParsingFinished()
|
|||||||
|
|
||||||
auto newRoot = std::make_unique<ProjectNode>(projectDirectory());
|
auto newRoot = std::make_unique<ProjectNode>(projectDirectory());
|
||||||
for (const QString &f : m_files) {
|
for (const QString &f : m_files) {
|
||||||
const Utils::FileName path = Utils::FileName::fromString(f);
|
const Utils::FilePath path = Utils::FilePath::fromString(f);
|
||||||
newRoot->addNestedNode(std::make_unique<FileNode>(path,
|
newRoot->addNestedNode(std::make_unique<FileNode>(path,
|
||||||
FileNode::fileTypeForFileName(path)));
|
FileNode::fileTypeForFileName(path)));
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,7 @@ class AutotoolsProject : public ProjectExplorer::Project
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutotoolsProject(const Utils::FileName &fileName);
|
explicit AutotoolsProject(const Utils::FilePath &fileName);
|
||||||
~AutotoolsProject() override;
|
~AutotoolsProject() override;
|
||||||
|
|
||||||
QStringList buildTargets() const;
|
QStringList buildTargets() const;
|
||||||
|
@@ -98,7 +98,7 @@ bool ConfigureStep::init()
|
|||||||
pp->setMacroExpander(bc->macroExpander());
|
pp->setMacroExpander(bc->macroExpander());
|
||||||
pp->setEnvironment(bc->environment());
|
pp->setEnvironment(bc->environment());
|
||||||
pp->setWorkingDirectory(bc->buildDirectory());
|
pp->setWorkingDirectory(bc->buildDirectory());
|
||||||
pp->setCommand(Utils::FileName::fromString(projectDirRelativeToBuildDir(bc) + "configure"));
|
pp->setCommand(Utils::FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure"));
|
||||||
pp->setArguments(m_additionalArgumentsAspect->value());
|
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||||
pp->resolveAll();
|
pp->resolveAll();
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ void ConfigureStep::updateDetails()
|
|||||||
param.setMacroExpander(bc->macroExpander());
|
param.setMacroExpander(bc->macroExpander());
|
||||||
param.setEnvironment(bc->environment());
|
param.setEnvironment(bc->environment());
|
||||||
param.setWorkingDirectory(bc->buildDirectory());
|
param.setWorkingDirectory(bc->buildDirectory());
|
||||||
param.setCommand(Utils::FileName::fromString(projectDirRelativeToBuildDir(bc) + "configure"));
|
param.setCommand(Utils::FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure"));
|
||||||
param.setArguments(m_additionalArgumentsAspect->value());
|
param.setArguments(m_additionalArgumentsAspect->value());
|
||||||
|
|
||||||
m_widget->setSummaryText(param.summaryInWorkdir(displayName()));
|
m_widget->setSummaryText(param.summaryInWorkdir(displayName()));
|
||||||
|
@@ -53,7 +53,7 @@ static GdbServerProviderManager *m_instance = nullptr;
|
|||||||
// GdbServerProviderManager
|
// GdbServerProviderManager
|
||||||
|
|
||||||
GdbServerProviderManager::GdbServerProviderManager()
|
GdbServerProviderManager::GdbServerProviderManager()
|
||||||
: m_configFile(Utils::FileName::fromString(Core::ICore::userResourcePath() + fileNameKeyC))
|
: m_configFile(Utils::FilePath::fromString(Core::ICore::userResourcePath() + fileNameKeyC))
|
||||||
, m_factories({new DefaultGdbServerProviderFactory,
|
, m_factories({new DefaultGdbServerProviderFactory,
|
||||||
new OpenOcdGdbServerProviderFactory,
|
new OpenOcdGdbServerProviderFactory,
|
||||||
new StLinkUtilGdbServerProviderFactory})
|
new StLinkUtilGdbServerProviderFactory})
|
||||||
|
@@ -73,7 +73,7 @@ private:
|
|||||||
|
|
||||||
Utils::PersistentSettingsWriter *m_writer = nullptr;
|
Utils::PersistentSettingsWriter *m_writer = nullptr;
|
||||||
QList<GdbServerProvider *> m_providers;
|
QList<GdbServerProvider *> m_providers;
|
||||||
const Utils::FileName m_configFile;
|
const Utils::FilePath m_configFile;
|
||||||
const QList<GdbServerProviderFactory *> m_factories;
|
const QList<GdbServerProviderFactory *> m_factories;
|
||||||
|
|
||||||
friend class BareMetalPlugin; // for restoreProviders
|
friend class BareMetalPlugin; // for restoreProviders
|
||||||
|
@@ -97,7 +97,7 @@ void IarParser::amendFilePath()
|
|||||||
QString filePath;
|
QString filePath;
|
||||||
while (!m_filePathParts.isEmpty())
|
while (!m_filePathParts.isEmpty())
|
||||||
filePath.append(m_filePathParts.takeFirst().trimmed());
|
filePath.append(m_filePathParts.takeFirst().trimmed());
|
||||||
m_lastTask.setFile(Utils::FileName::fromUserInput(filePath));
|
m_lastTask.setFile(Utils::FilePath::fromUserInput(filePath));
|
||||||
m_expectFilePath = false;
|
m_expectFilePath = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ void IarParser::stdError(const QString &line)
|
|||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
enum CaptureIndex { FilePathIndex = 1, LineNumberIndex,
|
enum CaptureIndex { FilePathIndex = 1, LineNumberIndex,
|
||||||
MessageTypeIndex, MessageCodeIndex };
|
MessageTypeIndex, MessageCodeIndex };
|
||||||
const Utils::FileName fileName = Utils::FileName::fromUserInput(
|
const Utils::FilePath fileName = Utils::FilePath::fromUserInput(
|
||||||
match.captured(FilePathIndex));
|
match.captured(FilePathIndex));
|
||||||
const int lineno = match.captured(LineNumberIndex).toInt();
|
const int lineno = match.captured(LineNumberIndex).toInt();
|
||||||
const Task::TaskType type = taskType(match.captured(MessageTypeIndex));
|
const Task::TaskType type = taskType(match.captured(MessageTypeIndex));
|
||||||
@@ -271,7 +271,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
<< QString()
|
<< QString()
|
||||||
<< (Tasks() << Task(Task::Error,
|
<< (Tasks() << Task(Task::Error,
|
||||||
QLatin1String("Error in command line: Some error"),
|
QLatin1String("Error in command line: Some error"),
|
||||||
Utils::FileName(),
|
Utils::FilePath(),
|
||||||
-1,
|
-1,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
@@ -286,7 +286,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
" Some warning \"foo\" bar\n")
|
" Some warning \"foo\" bar\n")
|
||||||
<< (Tasks() << Task(Task::Warning,
|
<< (Tasks() << Task(Task::Warning,
|
||||||
QLatin1String("[Pe223]: Some warning \"foo\" bar"),
|
QLatin1String("[Pe223]: Some warning \"foo\" bar"),
|
||||||
Utils::FileName::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
Utils::FilePath::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
||||||
63,
|
63,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
@@ -306,7 +306,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
QLatin1String("[Pe223]: Some warning\n"
|
QLatin1String("[Pe223]: Some warning\n"
|
||||||
" some_detail;\n"
|
" some_detail;\n"
|
||||||
" ^"),
|
" ^"),
|
||||||
Utils::FileName::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
Utils::FilePath::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
||||||
63,
|
63,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
@@ -322,7 +322,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
" , split\n")
|
" , split\n")
|
||||||
<< (Tasks() << Task(Task::Warning,
|
<< (Tasks() << Task(Task::Warning,
|
||||||
QLatin1String("[Pe223]: Some warning, split"),
|
QLatin1String("[Pe223]: Some warning, split"),
|
||||||
Utils::FileName::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
Utils::FilePath::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
||||||
63,
|
63,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
@@ -336,7 +336,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
" Some error\n")
|
" Some error\n")
|
||||||
<< (Tasks() << Task(Task::Error,
|
<< (Tasks() << Task(Task::Error,
|
||||||
QLatin1String("[Pe223]: Some error"),
|
QLatin1String("[Pe223]: Some error"),
|
||||||
Utils::FileName::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
Utils::FilePath::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
||||||
63,
|
63,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
@@ -356,7 +356,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
QLatin1String("[Pe223]: Some error\n"
|
QLatin1String("[Pe223]: Some error\n"
|
||||||
" some_detail;\n"
|
" some_detail;\n"
|
||||||
" ^"),
|
" ^"),
|
||||||
Utils::FileName::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
Utils::FilePath::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
||||||
63,
|
63,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
@@ -372,7 +372,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
" , split\n")
|
" , split\n")
|
||||||
<< (Tasks() << Task(Task::Error,
|
<< (Tasks() << Task(Task::Error,
|
||||||
QLatin1String("[Pe223]: Some error, split"),
|
QLatin1String("[Pe223]: Some error, split"),
|
||||||
Utils::FileName::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
Utils::FilePath::fromUserInput(QLatin1String("c:\\foo\\main.c")),
|
||||||
63,
|
63,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
@@ -390,7 +390,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
"]\n")
|
"]\n")
|
||||||
<< (Tasks() << Task(Task::Error,
|
<< (Tasks() << Task(Task::Error,
|
||||||
QLatin1String("[Li005]: Some error \"foo\""),
|
QLatin1String("[Li005]: Some error \"foo\""),
|
||||||
Utils::FileName::fromUserInput(QLatin1String("c:\\foo\\bar\\main.c.o")),
|
Utils::FilePath::fromUserInput(QLatin1String("c:\\foo\\bar\\main.c.o")),
|
||||||
-1,
|
-1,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
@@ -410,7 +410,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
QLatin1String("[Su011]: Some error:\n"
|
QLatin1String("[Su011]: Some error:\n"
|
||||||
" c:\\foo.c\n"
|
" c:\\foo.c\n"
|
||||||
" c:\\bar.c"),
|
" c:\\bar.c"),
|
||||||
Utils::FileName(),
|
Utils::FilePath(),
|
||||||
-1,
|
-1,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
@@ -422,7 +422,7 @@ void BareMetalPlugin::testIarOutputParsers_data()
|
|||||||
<< QString::fromLatin1("At end of source Error[Pe040]: Some error \";\"\n")
|
<< QString::fromLatin1("At end of source Error[Pe040]: Some error \";\"\n")
|
||||||
<< (Tasks() << Task(Task::Error,
|
<< (Tasks() << Task(Task::Error,
|
||||||
QLatin1String("[Pe040]: Some error \";\""),
|
QLatin1String("[Pe040]: Some error \";\""),
|
||||||
Utils::FileName(),
|
Utils::FilePath(),
|
||||||
-1,
|
-1,
|
||||||
categoryCompile))
|
categoryCompile))
|
||||||
<< QString();
|
<< QString();
|
||||||
|
@@ -60,13 +60,13 @@ namespace Internal {
|
|||||||
static const char compilerCommandKeyC[] = "BareMetal.IarToolChain.CompilerPath";
|
static const char compilerCommandKeyC[] = "BareMetal.IarToolChain.CompilerPath";
|
||||||
static const char targetAbiKeyC[] = "BareMetal.IarToolChain.TargetAbi";
|
static const char targetAbiKeyC[] = "BareMetal.IarToolChain.TargetAbi";
|
||||||
|
|
||||||
static bool compilerExists(const FileName &compilerPath)
|
static bool compilerExists(const FilePath &compilerPath)
|
||||||
{
|
{
|
||||||
const QFileInfo fi = compilerPath.toFileInfo();
|
const QFileInfo fi = compilerPath.toFileInfo();
|
||||||
return fi.exists() && fi.isExecutable() && fi.isFile();
|
return fi.exists() && fi.isExecutable() && fi.isFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Macros dumpPredefinedMacros(const FileName &compiler, const Core::Id languageId,
|
static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id languageId,
|
||||||
const QStringList &env)
|
const QStringList &env)
|
||||||
{
|
{
|
||||||
if (compiler.isEmpty() || !compiler.toFileInfo().isExecutable())
|
if (compiler.isEmpty() || !compiler.toFileInfo().isExecutable())
|
||||||
@@ -108,7 +108,7 @@ static Macros dumpPredefinedMacros(const FileName &compiler, const Core::Id lang
|
|||||||
return Macro::toMacros(output);
|
return Macro::toMacros(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HeaderPaths dumpHeaderPaths(const FileName &compiler, const Core::Id languageId,
|
static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const Core::Id languageId,
|
||||||
const QStringList &env)
|
const QStringList &env)
|
||||||
{
|
{
|
||||||
if (!compiler.exists())
|
if (!compiler.exists())
|
||||||
@@ -257,7 +257,7 @@ ToolChain::MacroInspectionRunner IarToolChain::createMacroInspectionRunner() con
|
|||||||
Environment env = Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
addToEnvironment(env);
|
addToEnvironment(env);
|
||||||
|
|
||||||
const Utils::FileName compilerCommand = m_compilerCommand;
|
const Utils::FilePath compilerCommand = m_compilerCommand;
|
||||||
const Core::Id languageId = language();
|
const Core::Id languageId = language();
|
||||||
|
|
||||||
MacrosCache macrosCache = predefinedMacrosCache();
|
MacrosCache macrosCache = predefinedMacrosCache();
|
||||||
@@ -299,7 +299,7 @@ ToolChain::BuiltInHeaderPathsRunner IarToolChain::createBuiltInHeaderPathsRunner
|
|||||||
Environment env = Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
addToEnvironment(env);
|
addToEnvironment(env);
|
||||||
|
|
||||||
const Utils::FileName compilerCommand = m_compilerCommand;
|
const Utils::FilePath compilerCommand = m_compilerCommand;
|
||||||
const Core::Id languageId = language();
|
const Core::Id languageId = language();
|
||||||
|
|
||||||
HeaderPathsCache headerPaths = headerPathsCache();
|
HeaderPathsCache headerPaths = headerPathsCache();
|
||||||
@@ -318,7 +318,7 @@ ToolChain::BuiltInHeaderPathsRunner IarToolChain::createBuiltInHeaderPathsRunner
|
|||||||
}
|
}
|
||||||
|
|
||||||
HeaderPaths IarToolChain::builtInHeaderPaths(const QStringList &cxxFlags,
|
HeaderPaths IarToolChain::builtInHeaderPaths(const QStringList &cxxFlags,
|
||||||
const FileName &fileName) const
|
const FilePath &fileName) const
|
||||||
{
|
{
|
||||||
return createBuiltInHeaderPathsRunner()(cxxFlags, fileName.toString(), "");
|
return createBuiltInHeaderPathsRunner()(cxxFlags, fileName.toString(), "");
|
||||||
}
|
}
|
||||||
@@ -326,7 +326,7 @@ HeaderPaths IarToolChain::builtInHeaderPaths(const QStringList &cxxFlags,
|
|||||||
void IarToolChain::addToEnvironment(Environment &env) const
|
void IarToolChain::addToEnvironment(Environment &env) const
|
||||||
{
|
{
|
||||||
if (!m_compilerCommand.isEmpty()) {
|
if (!m_compilerCommand.isEmpty()) {
|
||||||
const FileName path = m_compilerCommand.parentDir();
|
const FilePath path = m_compilerCommand.parentDir();
|
||||||
env.prependOrSetPath(path.toString());
|
env.prependOrSetPath(path.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,7 +348,7 @@ bool IarToolChain::fromMap(const QVariantMap &data)
|
|||||||
{
|
{
|
||||||
if (!ToolChain::fromMap(data))
|
if (!ToolChain::fromMap(data))
|
||||||
return false;
|
return false;
|
||||||
m_compilerCommand = FileName::fromString(data.value(compilerCommandKeyC).toString());
|
m_compilerCommand = FilePath::fromString(data.value(compilerCommandKeyC).toString());
|
||||||
m_targetAbi = Abi::fromString(data.value(targetAbiKeyC).toString());
|
m_targetAbi = Abi::fromString(data.value(targetAbiKeyC).toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -369,7 +369,7 @@ bool IarToolChain::operator==(const ToolChain &other) const
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IarToolChain::setCompilerCommand(const FileName &file)
|
void IarToolChain::setCompilerCommand(const FilePath &file)
|
||||||
{
|
{
|
||||||
if (file == m_compilerCommand)
|
if (file == m_compilerCommand)
|
||||||
return;
|
return;
|
||||||
@@ -377,12 +377,12 @@ void IarToolChain::setCompilerCommand(const FileName &file)
|
|||||||
toolChainUpdated();
|
toolChainUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName IarToolChain::compilerCommand() const
|
FilePath IarToolChain::compilerCommand() const
|
||||||
{
|
{
|
||||||
return m_compilerCommand;
|
return m_compilerCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName IarToolChain::makeCommand(const Environment &env) const
|
FilePath IarToolChain::makeCommand(const Environment &env) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(env)
|
Q_UNUSED(env)
|
||||||
return {};
|
return {};
|
||||||
@@ -575,7 +575,7 @@ void IarToolChainConfigWidget::setFromToolchain()
|
|||||||
|
|
||||||
void IarToolChainConfigWidget::handleCompilerCommandChange()
|
void IarToolChainConfigWidget::handleCompilerCommandChange()
|
||||||
{
|
{
|
||||||
const FileName compilerPath = m_compilerCommand->fileName();
|
const FilePath compilerPath = m_compilerCommand->fileName();
|
||||||
const bool haveCompiler = compilerExists(compilerPath);
|
const bool haveCompiler = compilerExists(compilerPath);
|
||||||
if (haveCompiler) {
|
if (haveCompiler) {
|
||||||
const auto env = Environment::systemEnvironment();
|
const auto env = Environment::systemEnvironment();
|
||||||
|
@@ -36,7 +36,7 @@ class QTextEdit;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class FileName;
|
class FilePath;
|
||||||
class PathChooser;
|
class PathChooser;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
|
|
||||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner() const final;
|
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner() const final;
|
||||||
ProjectExplorer::HeaderPaths builtInHeaderPaths(const QStringList &cxxFlags,
|
ProjectExplorer::HeaderPaths builtInHeaderPaths(const QStringList &cxxFlags,
|
||||||
const Utils::FileName &) const final;
|
const Utils::FilePath &) const final;
|
||||||
void addToEnvironment(Utils::Environment &env) const final;
|
void addToEnvironment(Utils::Environment &env) const final;
|
||||||
ProjectExplorer::IOutputParser *outputParser() const final;
|
ProjectExplorer::IOutputParser *outputParser() const final;
|
||||||
|
|
||||||
@@ -78,16 +78,16 @@ public:
|
|||||||
|
|
||||||
bool operator ==(const ToolChain &other) const final;
|
bool operator ==(const ToolChain &other) const final;
|
||||||
|
|
||||||
void setCompilerCommand(const Utils::FileName &file);
|
void setCompilerCommand(const Utils::FilePath &file);
|
||||||
Utils::FileName compilerCommand() const final;
|
Utils::FilePath compilerCommand() const final;
|
||||||
|
|
||||||
Utils::FileName makeCommand(const Utils::Environment &env) const final;
|
Utils::FilePath makeCommand(const Utils::Environment &env) const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IarToolChain();
|
IarToolChain();
|
||||||
|
|
||||||
ProjectExplorer::Abi m_targetAbi;
|
ProjectExplorer::Abi m_targetAbi;
|
||||||
Utils::FileName m_compilerCommand;
|
Utils::FilePath m_compilerCommand;
|
||||||
|
|
||||||
friend class IarToolChainFactory;
|
friend class IarToolChainFactory;
|
||||||
friend class IarToolChainConfigWidget;
|
friend class IarToolChainConfigWidget;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user