File indexing completed on 2025-04-27 05:18:56
0001 // SPDX-FileCopyrightText: 2020 Simon Persson <simon.persson@mykolab.com> 0002 // 0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 0005 #include "kuputils.h" 0006 0007 #include <QDir> 0008 0009 void ensureTrailingSlash(QString &pPath) { 0010 if(!pPath.endsWith(QDir::separator())) { 0011 pPath.append(QDir::separator()); 0012 } 0013 } 0014 0015 void ensureNoTrailingSlash(QString &pPath) { 0016 while(pPath.endsWith(QDir::separator())) { 0017 pPath.chop(1); 0018 } 0019 } 0020 0021 QString lastPartOfPath(const QString &pPath) { 0022 return pPath.section(QDir::separator(), -1, -1, QString::SectionSkipEmpty); 0023 }