forked from qt-creator/qt-creator
Do not use QDir::separator() for internal paths
Internal paths are supposed to be normalized Change-Id: Ic6943ce13ad389dfdb44054a9e6f03da8c6cd88d Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
704f3d539b
commit
1bcfa137a3
@@ -179,10 +179,8 @@ bool ProjectIntroPage::validate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check existence of the directory
|
// Check existence of the directory
|
||||||
QString projectDir = path();
|
const QFileInfo projectDirFile(path() + QLatin1Char('/')
|
||||||
projectDir += QDir::separator();
|
+ QDir::fromNativeSeparators(d->m_ui.nameLineEdit->text()));
|
||||||
projectDir += d->m_ui.nameLineEdit->text();
|
|
||||||
const QFileInfo projectDirFile(projectDir);
|
|
||||||
if (!projectDirFile.exists()) { // All happy
|
if (!projectDirFile.exists()) { // All happy
|
||||||
hideStatusLabel();
|
hideStatusLabel();
|
||||||
return nameValid;
|
return nameValid;
|
||||||
|
@@ -140,7 +140,7 @@ bool BazaarClient::synchronousSetUserId()
|
|||||||
|
|
||||||
BranchInfo BazaarClient::synchronousBranchQuery(const QString &repositoryRoot) const
|
BranchInfo BazaarClient::synchronousBranchQuery(const QString &repositoryRoot) const
|
||||||
{
|
{
|
||||||
QFile branchConfFile(repositoryRoot + QDir::separator() +
|
QFile branchConfFile(repositoryRoot + QLatin1Char('/') +
|
||||||
QLatin1String(Constants::BAZAARREPO) +
|
QLatin1String(Constants::BAZAARREPO) +
|
||||||
QLatin1String("/branch/branch.conf"));
|
QLatin1String("/branch/branch.conf"));
|
||||||
if (!branchConfFile.open(QIODevice::ReadOnly))
|
if (!branchConfFile.open(QIODevice::ReadOnly))
|
||||||
|
@@ -746,7 +746,7 @@ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QStr
|
|||||||
}
|
}
|
||||||
|
|
||||||
absoluteFilePath = getSaveFileName(tr("Save File As"),
|
absoluteFilePath = getSaveFileName(tr("Save File As"),
|
||||||
path + QDir::separator() + fileName,
|
path + QLatin1Char('/') + fileName,
|
||||||
filterString,
|
filterString,
|
||||||
selectedFilter);
|
selectedFilter);
|
||||||
return absoluteFilePath;
|
return absoluteFilePath;
|
||||||
|
@@ -347,8 +347,9 @@ static inline QString tempFilePattern(const QString &prefix, const QString &exte
|
|||||||
{
|
{
|
||||||
// Get directory
|
// Get directory
|
||||||
QString pattern = QDir::tempPath();
|
QString pattern = QDir::tempPath();
|
||||||
if (!pattern.endsWith(QDir::separator()))
|
const QChar slash = QLatin1Char('/');
|
||||||
pattern.append(QDir::separator());
|
if (!pattern.endsWith(slash))
|
||||||
|
pattern.append(slash);
|
||||||
// Prefix, placeholder, extension
|
// Prefix, placeholder, extension
|
||||||
pattern += prefix;
|
pattern += prefix;
|
||||||
pattern += QLatin1String("_XXXXXX.");
|
pattern += QLatin1String("_XXXXXX.");
|
||||||
|
@@ -284,10 +284,8 @@ void MercurialClient::incoming(const QString &repositoryRoot, const QString &rep
|
|||||||
args.append(repository);
|
args.append(repository);
|
||||||
|
|
||||||
QString id = repositoryRoot;
|
QString id = repositoryRoot;
|
||||||
if (!repository.isEmpty()) {
|
if (!repository.isEmpty())
|
||||||
id += QDir::separator();
|
id += QLatin1Char('/') + repository;
|
||||||
id += repository;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString title = tr("Hg incoming %1").arg(id);
|
const QString title = tr("Hg incoming %1").arg(id);
|
||||||
|
|
||||||
|
@@ -962,8 +962,9 @@ PerforcePlugin::createTemporaryArgumentFile(const QStringList &extraArgs,
|
|||||||
QString pattern = m_instance->m_tempFilePattern;
|
QString pattern = m_instance->m_tempFilePattern;
|
||||||
if (pattern.isEmpty()) {
|
if (pattern.isEmpty()) {
|
||||||
pattern = QDir::tempPath();
|
pattern = QDir::tempPath();
|
||||||
if (!pattern.endsWith(QDir::separator()))
|
const QChar slash = QLatin1Char('/');
|
||||||
pattern += QDir::separator();
|
if (!pattern.endsWith(slash))
|
||||||
|
pattern += slash;
|
||||||
pattern += QLatin1String("qtc_p4_XXXXXX.args");
|
pattern += QLatin1String("qtc_p4_XXXXXX.args");
|
||||||
m_instance->m_tempFilePattern = pattern;
|
m_instance->m_tempFilePattern = pattern;
|
||||||
}
|
}
|
||||||
|
@@ -914,13 +914,10 @@ bool QmlJSCompletionAssistProcessor::completeFileName(const QString &relativeBas
|
|||||||
{
|
{
|
||||||
const QFileInfo fileInfo(fileName);
|
const QFileInfo fileInfo(fileName);
|
||||||
QString directoryPrefix;
|
QString directoryPrefix;
|
||||||
if (fileInfo.isRelative()) {
|
if (fileInfo.isRelative())
|
||||||
directoryPrefix = relativeBasePath;
|
directoryPrefix = relativeBasePath + QLatin1Char('/') + fileInfo.path();
|
||||||
directoryPrefix += QDir::separator();
|
else
|
||||||
directoryPrefix += fileInfo.path();
|
|
||||||
} else {
|
|
||||||
directoryPrefix = fileInfo.path();
|
directoryPrefix = fileInfo.path();
|
||||||
}
|
|
||||||
if (!QFileInfo::exists(directoryPrefix))
|
if (!QFileInfo::exists(directoryPrefix))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -106,7 +106,7 @@ public:
|
|||||||
if (componentName.isEmpty() || path.isEmpty())
|
if (componentName.isEmpty() || path.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QString newFileName = path + QDir::separator() + componentName
|
const QString newFileName = path + QLatin1Char('/') + componentName
|
||||||
+ QLatin1String(".qml");
|
+ QLatin1String(".qml");
|
||||||
|
|
||||||
QString imports;
|
QString imports;
|
||||||
|
@@ -100,7 +100,7 @@ QList<Utils::EnvironmentItem> QnxUtils::qnxEnvironmentFromEnvFile(const QString
|
|||||||
|
|
||||||
// locking creating bbndk-env file wrapper script
|
// locking creating bbndk-env file wrapper script
|
||||||
QTemporaryFile tmpFile(
|
QTemporaryFile tmpFile(
|
||||||
QDir::tempPath() + QDir::separator()
|
QDir::tempPath() + QLatin1Char('/')
|
||||||
+ QLatin1String("bbndk-env-eval-XXXXXX") + QLatin1String(isWindows ? ".bat" : ".sh"));
|
+ QLatin1String("bbndk-env-eval-XXXXXX") + QLatin1String(isWindows ? ".bat" : ".sh"));
|
||||||
if (!tmpFile.open())
|
if (!tmpFile.open())
|
||||||
return items;
|
return items;
|
||||||
|
@@ -313,7 +313,7 @@ void QrcEditor::resolveLocationIssues(QStringList &files)
|
|||||||
if (clickedButton == context.copyButton) {
|
if (clickedButton == context.copyButton) {
|
||||||
const QFileInfo fi(file);
|
const QFileInfo fi(file);
|
||||||
QFileInfo suggestion;
|
QFileInfo suggestion;
|
||||||
QDir tmpTarget(dir.path() + QDir::separator() + QLatin1String("Resources"));
|
QDir tmpTarget(dir.path() + QLatin1Char('/') + QLatin1String("Resources"));
|
||||||
if (tmpTarget.exists())
|
if (tmpTarget.exists())
|
||||||
suggestion.setFile(tmpTarget, fi.fileName());
|
suggestion.setFile(tmpTarget, fi.fileName());
|
||||||
else
|
else
|
||||||
|
@@ -204,7 +204,7 @@ QString ResourceFile::contents() const
|
|||||||
const File &file = *f;
|
const File &file = *f;
|
||||||
QDomElement felt = doc.createElement(QLatin1String("file"));
|
QDomElement felt = doc.createElement(QLatin1String("file"));
|
||||||
relt.appendChild(felt);
|
relt.appendChild(felt);
|
||||||
const QString conv_file = relativePath(file.name).replace(QDir::separator(), QLatin1Char('/'));
|
const QString conv_file = QDir::fromNativeSeparators(relativePath(file.name));
|
||||||
const QDomText text = doc.createTextNode(conv_file);
|
const QDomText text = doc.createTextNode(conv_file);
|
||||||
felt.appendChild(text);
|
felt.appendChild(text);
|
||||||
if (!file.alias.isEmpty())
|
if (!file.alias.isEmpty())
|
||||||
@@ -428,7 +428,7 @@ QString ResourceFile::absolutePath(const QString &rel_path) const
|
|||||||
return rel_path;
|
return rel_path;
|
||||||
|
|
||||||
QString rc = QFileInfo(m_file_name).path();
|
QString rc = QFileInfo(m_file_name).path();
|
||||||
rc += QDir::separator();
|
rc += QLatin1Char('/');
|
||||||
rc += rel_path;
|
rc += rel_path;
|
||||||
return QDir::cleanPath(rc);
|
return QDir::cleanPath(rc);
|
||||||
}
|
}
|
||||||
|
@@ -674,8 +674,9 @@ bool VcsBaseSubmitEditor::runSubmitMessageCheckScript(const QString &checkScript
|
|||||||
{
|
{
|
||||||
// Write out message
|
// Write out message
|
||||||
QString tempFilePattern = QDir::tempPath();
|
QString tempFilePattern = QDir::tempPath();
|
||||||
if (!tempFilePattern.endsWith(QDir::separator()))
|
const QChar slash = QLatin1Char('/');
|
||||||
tempFilePattern += QDir::separator();
|
if (!tempFilePattern.endsWith(slash))
|
||||||
|
tempFilePattern += slash;
|
||||||
tempFilePattern += QLatin1String("msgXXXXXX.txt");
|
tempFilePattern += QLatin1String("msgXXXXXX.txt");
|
||||||
TempFileSaver saver(tempFilePattern);
|
TempFileSaver saver(tempFilePattern);
|
||||||
saver.write(fileContents());
|
saver.write(fileContents());
|
||||||
|
Reference in New Issue
Block a user