Ref T348, util function to correct FSX/P3D model path

Related: Ref T317 Ref T247 Ref T335
This commit is contained in:
Klaus Basan
2018-09-13 01:57:53 +02:00
parent 7f78981be7
commit a07d18aa44
4 changed files with 53 additions and 2 deletions

View File

@@ -129,6 +129,14 @@ namespace BlackMisc
return path.left(path.lastIndexOf('/'));
}
QString CFileUtils::lastPathSegment(const QString &path)
{
if (path.isEmpty()) { return QStringLiteral(""); }
if (path.endsWith('/')) { return CFileUtils::lastPathSegment(path.left(path.length() - 1)); }
if (!path.contains('/')) { return path; }
return path.mid(path.lastIndexOf('/') + 1);
}
QString CFileUtils::appendFilePaths(const QString &path1, const QString &path2, const QString &path3)
{
return CFileUtils::appendFilePaths(CFileUtils::appendFilePaths(path1, path2), path3);