feat: Import all the things!
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
@ -50,7 +50,7 @@ bool processFolder(DataPack& pack, ProcessingLevel level)
|
||||
Q_ASSERT(pack.type() == ResourceType::FOLDER);
|
||||
|
||||
auto mcmeta_invalid = [&pack]() {
|
||||
qWarning() << "Resource pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
|
||||
qWarning() << "Data pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
|
||||
return false; // the mcmeta is not optional
|
||||
};
|
||||
|
||||
@ -95,7 +95,7 @@ bool processZIP(DataPack& pack, ProcessingLevel level)
|
||||
QuaZipFile file(&zip);
|
||||
|
||||
auto mcmeta_invalid = [&pack]() {
|
||||
qWarning() << "Resource pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
|
||||
qWarning() << "Data pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
|
||||
return false; // the mcmeta is not optional
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "LocalResourceParse.h"
|
||||
|
||||
#include "LocalDataPackParseTask.h"
|
||||
@ -28,6 +30,17 @@
|
||||
#include "LocalTexturePackParseTask.h"
|
||||
#include "LocalWorldSaveParseTask.h"
|
||||
|
||||
|
||||
static const QMap<PackedResourceType, QString> s_packed_type_names = {
|
||||
{PackedResourceType::ResourcePack, QObject::tr("resource pack")},
|
||||
{PackedResourceType::TexturePack, QObject::tr("texture pack")},
|
||||
{PackedResourceType::DataPack, QObject::tr("data pack")},
|
||||
{PackedResourceType::ShaderPack, QObject::tr("shader pack")},
|
||||
{PackedResourceType::WorldSave, QObject::tr("world save")},
|
||||
{PackedResourceType::Mod , QObject::tr("mod")},
|
||||
{PackedResourceType::UNKNOWN, QObject::tr("unknown")}
|
||||
};
|
||||
|
||||
namespace ResourceUtils {
|
||||
PackedResourceType identify(QFileInfo file){
|
||||
if (file.exists() && file.isFile()) {
|
||||
@ -57,4 +70,12 @@ PackedResourceType identify(QFileInfo file){
|
||||
}
|
||||
return PackedResourceType::UNKNOWN;
|
||||
}
|
||||
|
||||
QString getPackedTypeName(PackedResourceType type) {
|
||||
return s_packed_type_names.constFind(type).value();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -21,11 +21,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QObject>
|
||||
|
||||
enum class PackedResourceType { DataPack, ResourcePack, TexturePack, ShaderPack, WorldSave, Mod, UNKNOWN };
|
||||
namespace ResourceUtils {
|
||||
static const std::set<PackedResourceType> ValidResourceTypes = { PackedResourceType::DataPack, PackedResourceType::ResourcePack,
|
||||
PackedResourceType::TexturePack, PackedResourceType::ShaderPack,
|
||||
PackedResourceType::WorldSave, PackedResourceType::Mod };
|
||||
PackedResourceType identify(QFileInfo file);
|
||||
QString getPackedTypeName(PackedResourceType type);
|
||||
} // namespace ResourceUtils
|
||||
|
Reference in New Issue
Block a user