RhythmGame 1.4.3
Loading...
Searching...
No Matches
FolderName.h
Go to the documentation of this file.
1#pragma once
2
3#include <QString>
4#include <QUrl>
5
6namespace support {
7
8inline auto
9folderName(QString path) -> QString
10{
11 path.replace(QLatin1Char('\\'), QLatin1Char('/'));
12 if (path.endsWith(QLatin1Char('/'))) {
13 path.chop(1);
14 }
15 const QUrl url(path);
16 // A one-letter scheme is a Windows drive, whose name must stay literal.
17 if (url.isValid() && url.scheme().size() > 1) {
18 return QUrl::fromPercentEncoding(
19 url.fileName(QUrl::FullyEncoded).toUtf8());
20 }
21 return path.mid(path.lastIndexOf(QLatin1Char('/')) + 1);
22}
23
24} // namespace support
QString path
Definition Lr2SkinParser.cpp:87
Contains various helper classes and functions.
Definition Capitalize.h:9
auto folderName(QString path) -> QString
Definition FolderName.h:9