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
|
||||
QString projectDir = path();
|
||||
projectDir += QDir::separator();
|
||||
projectDir += d->m_ui.nameLineEdit->text();
|
||||
const QFileInfo projectDirFile(projectDir);
|
||||
const QFileInfo projectDirFile(path() + QLatin1Char('/')
|
||||
+ QDir::fromNativeSeparators(d->m_ui.nameLineEdit->text()));
|
||||
if (!projectDirFile.exists()) { // All happy
|
||||
hideStatusLabel();
|
||||
return nameValid;
|
||||
|
@@ -140,7 +140,7 @@ bool BazaarClient::synchronousSetUserId()
|
||||
|
||||
BranchInfo BazaarClient::synchronousBranchQuery(const QString &repositoryRoot) const
|
||||
{
|
||||
QFile branchConfFile(repositoryRoot + QDir::separator() +
|
||||
QFile branchConfFile(repositoryRoot + QLatin1Char('/') +
|
||||
QLatin1String(Constants::BAZAARREPO) +
|
||||
QLatin1String("/branch/branch.conf"));
|
||||
if (!branchConfFile.open(QIODevice::ReadOnly))
|
||||
|
@@ -746,7 +746,7 @@ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QStr
|
||||
}
|
||||
|
||||
absoluteFilePath = getSaveFileName(tr("Save File As"),
|
||||
path + QDir::separator() + fileName,
|
||||
path + QLatin1Char('/') + fileName,
|
||||
filterString,
|
||||
selectedFilter);
|
||||
return absoluteFilePath;
|
||||
|
@@ -347,8 +347,9 @@ static inline QString tempFilePattern(const QString &prefix, const QString &exte
|
||||
{
|
||||
// Get directory
|
||||
QString pattern = QDir::tempPath();
|
||||
if (!pattern.endsWith(QDir::separator()))
|
||||
pattern.append(QDir::separator());
|
||||
const QChar slash = QLatin1Char('/');
|
||||
if (!pattern.endsWith(slash))
|
||||
pattern.append(slash);
|
||||
// Prefix, placeholder, extension
|
||||
pattern += prefix;
|
||||
pattern += QLatin1String("_XXXXXX.");
|
||||
|
@@ -284,10 +284,8 @@ void MercurialClient::incoming(const QString &repositoryRoot, const QString &rep
|
||||
args.append(repository);
|
||||
|
||||
QString id = repositoryRoot;
|
||||
if (!repository.isEmpty()) {
|
||||
id += QDir::separator();
|
||||
id += repository;
|
||||
}
|
||||
if (!repository.isEmpty())
|
||||
id += QLatin1Char('/') + repository;
|
||||
|
||||
const QString title = tr("Hg incoming %1").arg(id);
|
||||
|
||||
|
@@ -962,8 +962,9 @@ PerforcePlugin::createTemporaryArgumentFile(const QStringList &extraArgs,
|
||||
QString pattern = m_instance->m_tempFilePattern;
|
||||
if (pattern.isEmpty()) {
|
||||
pattern = QDir::tempPath();
|
||||
if (!pattern.endsWith(QDir::separator()))
|
||||
pattern += QDir::separator();
|
||||
const QChar slash = QLatin1Char('/');
|
||||
if (!pattern.endsWith(slash))
|
||||
pattern += slash;
|
||||
pattern += QLatin1String("qtc_p4_XXXXXX.args");
|
||||
m_instance->m_tempFilePattern = pattern;
|
||||
}
|
||||
|
@@ -914,13 +914,10 @@ bool QmlJSCompletionAssistProcessor::completeFileName(const QString &relativeBas
|
||||
{
|
||||
const QFileInfo fileInfo(fileName);
|
||||
QString directoryPrefix;
|
||||
if (fileInfo.isRelative()) {
|
||||
directoryPrefix = relativeBasePath;
|
||||
directoryPrefix += QDir::separator();
|
||||
directoryPrefix += fileInfo.path();
|
||||
} else {
|
||||
if (fileInfo.isRelative())
|
||||
directoryPrefix = relativeBasePath + QLatin1Char('/') + fileInfo.path();
|
||||
else
|
||||
directoryPrefix = fileInfo.path();
|
||||
}
|
||||
if (!QFileInfo::exists(directoryPrefix))
|
||||
return false;
|
||||
|
||||
|
@@ -106,7 +106,7 @@ public:
|
||||
if (componentName.isEmpty() || path.isEmpty())
|
||||
return;
|
||||
|
||||
const QString newFileName = path + QDir::separator() + componentName
|
||||
const QString newFileName = path + QLatin1Char('/') + componentName
|
||||
+ QLatin1String(".qml");
|
||||
|
||||
QString imports;
|
||||
|
@@ -100,7 +100,7 @@ QList<Utils::EnvironmentItem> QnxUtils::qnxEnvironmentFromEnvFile(const QString
|
||||
|
||||
// locking creating bbndk-env file wrapper script
|
||||
QTemporaryFile tmpFile(
|
||||
QDir::tempPath() + QDir::separator()
|
||||
QDir::tempPath() + QLatin1Char('/')
|
||||
+ QLatin1String("bbndk-env-eval-XXXXXX") + QLatin1String(isWindows ? ".bat" : ".sh"));
|
||||
if (!tmpFile.open())
|
||||
return items;
|
||||
|
@@ -313,7 +313,7 @@ void QrcEditor::resolveLocationIssues(QStringList &files)
|
||||
if (clickedButton == context.copyButton) {
|
||||
const QFileInfo fi(file);
|
||||
QFileInfo suggestion;
|
||||
QDir tmpTarget(dir.path() + QDir::separator() + QLatin1String("Resources"));
|
||||
QDir tmpTarget(dir.path() + QLatin1Char('/') + QLatin1String("Resources"));
|
||||
if (tmpTarget.exists())
|
||||
suggestion.setFile(tmpTarget, fi.fileName());
|
||||
else
|
||||
|
@@ -204,7 +204,7 @@ QString ResourceFile::contents() const
|
||||
const File &file = *f;
|
||||
QDomElement felt = doc.createElement(QLatin1String("file"));
|
||||
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);
|
||||
felt.appendChild(text);
|
||||
if (!file.alias.isEmpty())
|
||||
@@ -428,7 +428,7 @@ QString ResourceFile::absolutePath(const QString &rel_path) const
|
||||
return rel_path;
|
||||
|
||||
QString rc = QFileInfo(m_file_name).path();
|
||||
rc += QDir::separator();
|
||||
rc += QLatin1Char('/');
|
||||
rc += rel_path;
|
||||
return QDir::cleanPath(rc);
|
||||
}
|
||||
|
@@ -674,8 +674,9 @@ bool VcsBaseSubmitEditor::runSubmitMessageCheckScript(const QString &checkScript
|
||||
{
|
||||
// Write out message
|
||||
QString tempFilePattern = QDir::tempPath();
|
||||
if (!tempFilePattern.endsWith(QDir::separator()))
|
||||
tempFilePattern += QDir::separator();
|
||||
const QChar slash = QLatin1Char('/');
|
||||
if (!tempFilePattern.endsWith(slash))
|
||||
tempFilePattern += slash;
|
||||
tempFilePattern += QLatin1String("msgXXXXXX.txt");
|
||||
TempFileSaver saver(tempFilePattern);
|
||||
saver.write(fileContents());
|
||||
|
Reference in New Issue
Block a user