change: support newest changes with packwiz regarding CF
This commit is contained in:
@ -14,9 +14,9 @@ namespace Packwiz {
|
||||
// Helpers
|
||||
static inline auto indexFileName(QString const& mod_name) -> QString
|
||||
{
|
||||
if(mod_name.endsWith(".toml"))
|
||||
if(mod_name.endsWith(".pw.toml"))
|
||||
return mod_name;
|
||||
return QString("%1.toml").arg(mod_name);
|
||||
return QString("%1.pw.toml").arg(mod_name);
|
||||
}
|
||||
|
||||
static ModPlatform::ProviderCapabilities ProviderCaps;
|
||||
@ -28,7 +28,14 @@ auto V1::createModFormat(QDir& index_dir, ModPlatform::IndexedPack& mod_pack, Mo
|
||||
mod.name = mod_pack.name;
|
||||
mod.filename = mod_version.fileName;
|
||||
|
||||
mod.url = mod_version.downloadUrl;
|
||||
if(mod_pack.provider == ModPlatform::Provider::FLAME){
|
||||
mod.mode = "metadata:curseforge";
|
||||
}
|
||||
else {
|
||||
mod.mode = "url";
|
||||
mod.url = mod_version.downloadUrl;
|
||||
}
|
||||
|
||||
mod.hash_format = mod_version.hash_type;
|
||||
mod.hash = mod_version.hash;
|
||||
|
||||
@ -84,6 +91,7 @@ void V1::updateModIndex(QDir& index_dir, Mod& mod)
|
||||
addToStream("side", mod.side);
|
||||
|
||||
in_stream << QString("\n[download]\n");
|
||||
addToStream("mode", mod.mode);
|
||||
addToStream("url", mod.url.toString());
|
||||
addToStream("hash-format", mod.hash_format);
|
||||
addToStream("hash", mod.hash);
|
||||
@ -186,6 +194,7 @@ auto V1::getIndexForMod(QDir& index_dir, QString& index_file_name) -> Mod
|
||||
return {};
|
||||
}
|
||||
|
||||
mod.mode = stringEntry(download_table, "mode");
|
||||
mod.url = stringEntry(download_table, "url");
|
||||
mod.hash_format = stringEntry(download_table, "hash-format");
|
||||
mod.hash = stringEntry(download_table, "hash");
|
||||
|
@ -22,8 +22,8 @@ class V1 {
|
||||
QString side {"both"};
|
||||
|
||||
// [download]
|
||||
QString mode {};
|
||||
QUrl url {};
|
||||
// FIXME: make hash-format an enum
|
||||
QString hash_format {};
|
||||
QString hash {};
|
||||
|
||||
@ -42,11 +42,11 @@ class V1 {
|
||||
auto version() -> QVariant& { return file_id; }
|
||||
};
|
||||
|
||||
/* Generates the object representing the information in a mod.toml file via
|
||||
/* Generates the object representing the information in a mod.pw.toml file via
|
||||
* its common representation in the launcher, when downloading mods.
|
||||
* */
|
||||
static auto createModFormat(QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version) -> Mod;
|
||||
/* Generates the object representing the information in a mod.toml file via
|
||||
/* Generates the object representing the information in a mod.pw.toml file via
|
||||
* its common representation in the launcher.
|
||||
* */
|
||||
static auto createModFormat(QDir& index_dir, ::Mod& internal_mod) -> Mod;
|
||||
|
@ -14,7 +14,7 @@ class PackwizTest : public QObject {
|
||||
QString source = QFINDTESTDATA("testdata");
|
||||
|
||||
QDir index_dir(source);
|
||||
QString name_mod("borderless-mining.toml");
|
||||
QString name_mod("borderless-mining.pw.toml");
|
||||
QVERIFY(index_dir.entryList().contains(name_mod));
|
||||
|
||||
auto metadata = Packwiz::V1::getIndexForMod(index_dir, name_mod);
|
||||
@ -39,10 +39,10 @@ class PackwizTest : public QObject {
|
||||
QString source = QFINDTESTDATA("testdata");
|
||||
|
||||
QDir index_dir(source);
|
||||
QString name_mod("screenshot-to-clipboard-fabric.toml");
|
||||
QString name_mod("screenshot-to-clipboard-fabric.pw.toml");
|
||||
QVERIFY(index_dir.entryList().contains(name_mod));
|
||||
|
||||
// Try without the .toml at the end
|
||||
// Try without the .pw.toml at the end
|
||||
name_mod.chop(5);
|
||||
|
||||
auto metadata = Packwiz::V1::getIndexForMod(index_dir, name_mod);
|
||||
|
Reference in New Issue
Block a user