Replace string manipulation in favour of QFileInfo

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2023-07-09 12:08:15 +01:00
parent 8ae67b84db
commit 6e2fcc9e11

View File

@ -301,10 +301,10 @@ QByteArray ModrinthPackExportTask::generateIndex()
const ResolvedFile& value = iterator.value();
// detect disabled mod
QString disabledSuffix = ".disabled";
if (path.endsWith(disabledSuffix)) {
const QFileInfo pathInfo(path);
if (pathInfo.suffix() == "disabled") {
// rename it
path = path.left(path.length() - disabledSuffix.length());
path = pathInfo.dir().filePath(pathInfo.completeBaseName());
// ...and make it optional
QJsonObject env;
env["client"] = "optional";