mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Improved string concat to avoid "//" in paths
This commit is contained in:
committed by
Mat Sutcliffe
parent
fa8eed1611
commit
458daa4532
@@ -26,6 +26,7 @@
|
||||
#include <QtGlobal>
|
||||
#include <QMap>
|
||||
#include <algorithm>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc::Math;
|
||||
@@ -115,7 +116,13 @@ namespace BlackMisc
|
||||
{
|
||||
if (path1.isEmpty()) { return QDir::cleanPath(path2); }
|
||||
if (path2.isEmpty()) { return QDir::cleanPath(path1); }
|
||||
return QDir::cleanPath(path1 + QChar('/') + path2);
|
||||
if (path1.endsWith('/'))
|
||||
{
|
||||
// avoid double /
|
||||
if (path2.startsWith('/')) { return QDir::cleanPath(path1 % path2.mid(1)); }
|
||||
return QDir::cleanPath(path1 % path2);
|
||||
}
|
||||
return QDir::cleanPath(path1 % QChar('/') % path2);
|
||||
}
|
||||
|
||||
QString CFileUtils::appendFilePathsAndFixUnc(const QString &path1, const QString &path2)
|
||||
|
||||
Reference in New Issue
Block a user