NOISSUE move creation of server resource pack folder to a separate task
This commit is contained in:
parent
1f2bed2ef1
commit
42a98c3661
@ -200,6 +200,8 @@ set(MINECRAFT_SOURCES
|
|||||||
minecraft/onesix/OneSixProfileStrategy.h
|
minecraft/onesix/OneSixProfileStrategy.h
|
||||||
minecraft/onesix/OneSixVersionFormat.cpp
|
minecraft/onesix/OneSixVersionFormat.cpp
|
||||||
minecraft/onesix/OneSixVersionFormat.h
|
minecraft/onesix/OneSixVersionFormat.h
|
||||||
|
minecraft/launch/CreateServerResourcePacksFolder.cpp
|
||||||
|
minecraft/launch/CreateServerResourcePacksFolder.h
|
||||||
minecraft/launch/ModMinecraftJar.cpp
|
minecraft/launch/ModMinecraftJar.cpp
|
||||||
minecraft/launch/ModMinecraftJar.h
|
minecraft/launch/ModMinecraftJar.h
|
||||||
minecraft/launch/DirectJavaLaunch.cpp
|
minecraft/launch/DirectJavaLaunch.cpp
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "MinecraftInstance.h"
|
#include "MinecraftInstance.h"
|
||||||
|
#include <minecraft/launch/CreateServerResourcePacksFolder.h>
|
||||||
#include <minecraft/launch/ExtractNatives.h>
|
#include <minecraft/launch/ExtractNatives.h>
|
||||||
#include <minecraft/launch/PrintInstanceInfo.h>
|
#include <minecraft/launch/PrintInstanceInfo.h>
|
||||||
#include <settings/Setting.h>
|
#include <settings/Setting.h>
|
||||||
@ -433,6 +434,12 @@ std::shared_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPtr s
|
|||||||
process->appendStep(step);
|
process->appendStep(step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create the server-resource-packs folder (workaround for Minecraft bug MCL-3732)
|
||||||
|
{
|
||||||
|
auto step = std::make_shared<CreateServerResourcePacksFolder>(pptr);
|
||||||
|
process->appendStep(step);
|
||||||
|
}
|
||||||
|
|
||||||
// extract native jars if needed
|
// extract native jars if needed
|
||||||
auto jars = getNativeJars();
|
auto jars = getNativeJars();
|
||||||
if(jars.size())
|
if(jars.size())
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
#include "CreateServerResourcePacksFolder.h"
|
||||||
|
#include "minecraft/MinecraftInstance.h"
|
||||||
|
#include "launch/LaunchTask.h"
|
||||||
|
#include "FileSystem.h""
|
||||||
|
|
||||||
|
CreateServerResourcePacksFolder::CreateServerResourcePacksFolder(LaunchTask* parent): LaunchStep(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateServerResourcePacksFolder::executeTask()
|
||||||
|
{
|
||||||
|
auto instance = m_parent->instance();
|
||||||
|
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
|
||||||
|
if(!FS::ensureFolderPathExists(FS::PathCombine(minecraftInstance->minecraftRoot(), "server-resource-packs")))
|
||||||
|
{
|
||||||
|
emit logLine(tr("Couldn't create the 'server-resource-packs' folder"), MessageLevel::Error);
|
||||||
|
}
|
||||||
|
emitSucceeded();
|
||||||
|
}
|
35
api/logic/minecraft/launch/CreateServerResourcePacksFolder.h
Normal file
35
api/logic/minecraft/launch/CreateServerResourcePacksFolder.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/* Copyright 2013-2016 MultiMC Contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <launch/LaunchStep.h>
|
||||||
|
#include <launch/LoggedProcess.h>
|
||||||
|
#include <minecraft/auth/AuthSession.h>
|
||||||
|
|
||||||
|
// HACK: this is a workaround for MCL-3732 - 'server-resource-packs' folder is created.
|
||||||
|
class CreateServerResourcePacksFolder: public LaunchStep
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CreateServerResourcePacksFolder(LaunchTask *parent);
|
||||||
|
virtual void executeTask();
|
||||||
|
virtual bool canAbort() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -31,12 +31,6 @@ void DirectJavaLaunch::executeTask()
|
|||||||
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
|
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
|
||||||
QStringList args = minecraftInstance->javaArguments();
|
QStringList args = minecraftInstance->javaArguments();
|
||||||
|
|
||||||
// HACK: this is a workaround for MCL-3732 - 'server-resource-packs' is created.
|
|
||||||
if(!FS::ensureFolderPathExists(FS::PathCombine(minecraftInstance->minecraftRoot(), "server-resource-packs")))
|
|
||||||
{
|
|
||||||
emit logLine(tr("Couldn't create the 'server-resource-packs' folder"), MessageLevel::Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
args.append("-Djava.library.path=" + minecraftInstance->getNativePath());
|
args.append("-Djava.library.path=" + minecraftInstance->getNativePath());
|
||||||
|
|
||||||
auto classPathEntries = minecraftInstance->getClassPath();
|
auto classPathEntries = minecraftInstance->getClassPath();
|
||||||
|
@ -33,13 +33,6 @@ void LauncherPartLaunch::executeTask()
|
|||||||
|
|
||||||
m_launchScript = minecraftInstance->createLaunchScript(m_session);
|
m_launchScript = minecraftInstance->createLaunchScript(m_session);
|
||||||
QStringList args = minecraftInstance->javaArguments();
|
QStringList args = minecraftInstance->javaArguments();
|
||||||
|
|
||||||
// HACK: this is a workaround for MCL-3732 - 'server-resource-packs' is created.
|
|
||||||
if(!FS::ensureFolderPathExists(FS::PathCombine(minecraftInstance->minecraftRoot(), "server-resource-packs")))
|
|
||||||
{
|
|
||||||
emit logLine(tr("Couldn't create the 'server-resource-packs' folder"), MessageLevel::Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString allArgs = args.join(", ");
|
QString allArgs = args.join(", ");
|
||||||
emit logLine("Java Arguments:\n[" + m_parent->censorPrivateInfo(allArgs) + "]\n\n", MessageLevel::MultiMC);
|
emit logLine("Java Arguments:\n[" + m_parent->censorPrivateInfo(allArgs) + "]\n\n", MessageLevel::MultiMC);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user