Merge pull request #1575 from TheKodeToad/more-pack-export-fixes
This commit is contained in:
commit
b83fdbd1b7
@ -267,10 +267,7 @@ bool FileIgnoreProxy::filterAcceptsRow(int sourceRow, const QModelIndex& sourceP
|
|||||||
|
|
||||||
bool FileIgnoreProxy::ignoreFile(QFileInfo fileInfo) const
|
bool FileIgnoreProxy::ignoreFile(QFileInfo fileInfo) const
|
||||||
{
|
{
|
||||||
auto fileName = fileInfo.fileName();
|
return m_ignoreFiles.contains(fileInfo.fileName()) || m_ignoreFilePaths.covers(relPath(fileInfo.absoluteFilePath()));
|
||||||
auto path = relPath(fileInfo.absoluteFilePath());
|
|
||||||
return std::any_of(m_ignoreFiles.cbegin(), m_ignoreFiles.cend(), [fileName](auto iFileName) { return fileName == iFileName; }) ||
|
|
||||||
m_ignoreFilePaths.covers(path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileIgnoreProxy::filterFile(const QString& fileName) const
|
bool FileIgnoreProxy::filterFile(const QString& fileName) const
|
||||||
|
@ -81,10 +81,9 @@ ExportPackDialog::ExportPackDialog(InstancePtr instance, QWidget* parent, ModPla
|
|||||||
|
|
||||||
MinecraftInstance* mcInstance = dynamic_cast<MinecraftInstance*>(instance.get());
|
MinecraftInstance* mcInstance = dynamic_cast<MinecraftInstance*>(instance.get());
|
||||||
if (mcInstance) {
|
if (mcInstance) {
|
||||||
mcInstance->loaderModList()->update();
|
|
||||||
const QDir index = mcInstance->loaderModList()->indexDir();
|
const QDir index = mcInstance->loaderModList()->indexDir();
|
||||||
if (index.exists())
|
if (index.exists())
|
||||||
proxy->blockedPaths().insert(root.relativeFilePath(index.absolutePath()));
|
proxy->ignoreFilesWithPath().insert(root.relativeFilePath(index.absolutePath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->files->setModel(proxy);
|
ui->files->setModel(proxy);
|
||||||
@ -120,18 +119,19 @@ void ExportPackDialog::done(int result)
|
|||||||
if (m_provider == ModPlatform::ResourceProvider::MODRINTH) {
|
if (m_provider == ModPlatform::ResourceProvider::MODRINTH) {
|
||||||
output = QFileDialog::getSaveFileName(this, tr("Export %1").arg(name), FS::PathCombine(QDir::homePath(), filename + ".mrpack"),
|
output = QFileDialog::getSaveFileName(this, tr("Export %1").arg(name), FS::PathCombine(QDir::homePath(), filename + ".mrpack"),
|
||||||
"Modrinth pack (*.mrpack *.zip)", nullptr);
|
"Modrinth pack (*.mrpack *.zip)", nullptr);
|
||||||
|
if (output.isEmpty())
|
||||||
|
return;
|
||||||
if (!(output.endsWith(".zip") || output.endsWith(".mrpack")))
|
if (!(output.endsWith(".zip") || output.endsWith(".mrpack")))
|
||||||
output.append(".mrpack");
|
output.append(".mrpack");
|
||||||
} else {
|
} else {
|
||||||
output = QFileDialog::getSaveFileName(this, tr("Export %1").arg(name), FS::PathCombine(QDir::homePath(), filename + ".zip"),
|
output = QFileDialog::getSaveFileName(this, tr("Export %1").arg(name), FS::PathCombine(QDir::homePath(), filename + ".zip"),
|
||||||
"CurseForge pack (*.zip)", nullptr);
|
"CurseForge pack (*.zip)", nullptr);
|
||||||
|
if (output.isEmpty())
|
||||||
|
return;
|
||||||
if (!output.endsWith(".zip"))
|
if (!output.endsWith(".zip"))
|
||||||
output.append(".zip");
|
output.append(".zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Task* task;
|
Task* task;
|
||||||
if (m_provider == ModPlatform::ResourceProvider::MODRINTH) {
|
if (m_provider == ModPlatform::ResourceProvider::MODRINTH) {
|
||||||
task = new ModrinthPackExportTask(name, ui->version->text(), ui->summary->text(), ui->optionalFiles->isChecked(), instance,
|
task = new ModrinthPackExportTask(name, ui->version->text(), ui->summary->text(), ui->optionalFiles->isChecked(), instance,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user