1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-08 23:22:25 +02:00

hopefully fixed things

This commit is contained in:
Zyx-2000
2016-01-09 21:23:55 +01:00
parent cdd50b1603
commit 203b2dccc3
19 changed files with 83 additions and 39 deletions

View File

@@ -2,6 +2,7 @@
#include <QVariantMap>
#include <QVariant>
#include <QVector>
class JsonNode;

View File

@@ -1,6 +1,6 @@
#pragma once
#include "../../Global.h"
#include "StdInc.h"
#include "../../lib/CConfigHandler.h"
namespace Ui {
@@ -55,7 +55,7 @@ class CModListView : public QWidget
public:
explicit CModListView(QWidget *parent = 0);
~CModListView();
void showModInfo();
void hideModInfo();
void loadScreenshots();

View File

@@ -11,7 +11,7 @@
static QString detectModArchive(QString path, QString modName)
{
auto files = ZipArchive::listFiles(path.toUtf8().data());
auto files = ZipArchive::listFiles(qstringToPath(path));
QString modDirName;
@@ -69,8 +69,8 @@ void CModManager::loadMods()
ResourceID resID(CModInfo::getModFile(modname));
if (CResourceHandler::get()->existsResource(resID))
{
std::string name = *CResourceHandler::get()->getResourceName(resID);
auto mod = JsonUtils::JsonFromFile(QString::fromUtf8(name.c_str()));
boost::filesystem::path name = *CResourceHandler::get()->getResourceName(resID);
auto mod = JsonUtils::JsonFromFile(QString::fromUtf8(name.string().c_str()));
localMods.insert(QString::fromUtf8(modname.c_str()).toLower(), mod);
}
}
@@ -243,7 +243,7 @@ bool CModManager::doInstallMod(QString modname, QString archivePath)
if (!modDirName.size())
return addError(modname, "Mod archive is invalid or corrupted");
if (!ZipArchive::extract(archivePath.toUtf8().data(), destDir.toUtf8().data()))
if (!ZipArchive::extract(qstringToPath(archivePath), qstringToPath(destDir)))
{
QDir(destDir + modDirName).removeRecursively();
return addError(modname, "Failed to extract mod data");
@@ -262,7 +262,7 @@ bool CModManager::doUninstallMod(QString modname)
{
ResourceID resID(std::string("Mods/") + modname.toUtf8().data(), EResType::DIRECTORY);
// Get location of the mod, in case-insensitive way
QString modDir = QString::fromUtf8(CResourceHandler::get()->getResourceName(resID)->c_str());
QString modDir = QString::fromUtf8((*CResourceHandler::get()->getResourceName(resID)).c_str());
if (!QDir(modDir).exists())
return addError(modname, "Data with this mod was not found");