GH-2352 Add Minecraft folder button for instances, rearrange buttons by importance
This commit is contained in:
@ -102,6 +102,12 @@ public:
|
||||
/// Path to the instance's root directory.
|
||||
QString instanceRoot() const;
|
||||
|
||||
/// Path to the instance's game root directory.
|
||||
virtual QString gameRoot() const
|
||||
{
|
||||
return instanceRoot();
|
||||
}
|
||||
|
||||
QString name() const;
|
||||
void setName(QString val);
|
||||
|
||||
|
@ -146,7 +146,7 @@ QSet<QString> MinecraftInstance::traits() const
|
||||
return profile->getTraits();
|
||||
}
|
||||
|
||||
QString MinecraftInstance::minecraftRoot() const
|
||||
QString MinecraftInstance::gameRoot() const
|
||||
{
|
||||
QFileInfo mcDir(FS::PathCombine(instanceRoot(), "minecraft"));
|
||||
QFileInfo dotMCDir(FS::PathCombine(instanceRoot(), ".minecraft"));
|
||||
@ -159,7 +159,7 @@ QString MinecraftInstance::minecraftRoot() const
|
||||
|
||||
QString MinecraftInstance::binRoot() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "bin");
|
||||
return FS::PathCombine(gameRoot(), "bin");
|
||||
}
|
||||
|
||||
QString MinecraftInstance::getNativePath() const
|
||||
@ -176,7 +176,7 @@ QString MinecraftInstance::getLocalLibraryPath() const
|
||||
|
||||
QString MinecraftInstance::loaderModsDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "mods");
|
||||
return FS::PathCombine(gameRoot(), "mods");
|
||||
}
|
||||
|
||||
QString MinecraftInstance::modsCacheLocation() const
|
||||
@ -186,22 +186,22 @@ QString MinecraftInstance::modsCacheLocation() const
|
||||
|
||||
QString MinecraftInstance::coreModsDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "coremods");
|
||||
return FS::PathCombine(gameRoot(), "coremods");
|
||||
}
|
||||
|
||||
QString MinecraftInstance::resourcePacksDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "resourcepacks");
|
||||
return FS::PathCombine(gameRoot(), "resourcepacks");
|
||||
}
|
||||
|
||||
QString MinecraftInstance::texturePacksDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "texturepacks");
|
||||
return FS::PathCombine(gameRoot(), "texturepacks");
|
||||
}
|
||||
|
||||
QString MinecraftInstance::instanceConfigFolder() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "config");
|
||||
return FS::PathCombine(gameRoot(), "config");
|
||||
}
|
||||
|
||||
QString MinecraftInstance::jarModsDir() const
|
||||
@ -211,12 +211,12 @@ QString MinecraftInstance::jarModsDir() const
|
||||
|
||||
QString MinecraftInstance::libDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "lib");
|
||||
return FS::PathCombine(gameRoot(), "lib");
|
||||
}
|
||||
|
||||
QString MinecraftInstance::worldDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "saves");
|
||||
return FS::PathCombine(gameRoot(), "saves");
|
||||
}
|
||||
|
||||
QDir MinecraftInstance::librariesPath() const
|
||||
@ -336,7 +336,7 @@ QMap<QString, QString> MinecraftInstance::getVariables() const
|
||||
out.insert("INST_NAME", name());
|
||||
out.insert("INST_ID", id());
|
||||
out.insert("INST_DIR", QDir(instanceRoot()).absolutePath());
|
||||
out.insert("INST_MC_DIR", QDir(minecraftRoot()).absolutePath());
|
||||
out.insert("INST_MC_DIR", QDir(gameRoot()).absolutePath());
|
||||
out.insert("INST_JAVA", settings()->get("JavaPath").toString());
|
||||
out.insert("INST_JAVA_ARGS", javaArguments().join(' '));
|
||||
return out;
|
||||
@ -407,7 +407,7 @@ QStringList MinecraftInstance::processMinecraftArgs(AuthSessionPtr session) cons
|
||||
|
||||
token_mapping["version_type"] = profile->getMinecraftVersionType();
|
||||
|
||||
QString absRootDir = QDir(minecraftRoot()).absolutePath();
|
||||
QString absRootDir = QDir(gameRoot()).absolutePath();
|
||||
token_mapping["game_directory"] = absRootDir;
|
||||
QString absAssetsDir = QDir("assets/").absolutePath();
|
||||
auto assets = profile->getMinecraftAssets();
|
||||
@ -716,7 +716,7 @@ IPathMatcher::Ptr MinecraftInstance::getLogFileMatcher()
|
||||
|
||||
QString MinecraftInstance::getLogFileRoot()
|
||||
{
|
||||
return minecraftRoot();
|
||||
return gameRoot();
|
||||
}
|
||||
|
||||
QString MinecraftInstance::prettifyTimeDuration(int64_t duration)
|
||||
@ -780,11 +780,11 @@ std::shared_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPtr s
|
||||
auto process = LaunchTask::create(std::dynamic_pointer_cast<MinecraftInstance>(getSharedPtr()));
|
||||
auto pptr = process.get();
|
||||
|
||||
ENV.icons()->saveIcon(iconKey(), FS::PathCombine(minecraftRoot(), "icon.png"), "PNG");
|
||||
ENV.icons()->saveIcon(iconKey(), FS::PathCombine(gameRoot(), "icon.png"), "PNG");
|
||||
|
||||
// print a header
|
||||
{
|
||||
process->appendStep(std::make_shared<TextPrint>(pptr, "Minecraft folder is:\n" + minecraftRoot() + "\n\n", MessageLevel::MultiMC));
|
||||
process->appendStep(std::make_shared<TextPrint>(pptr, "Minecraft folder is:\n" + gameRoot() + "\n\n", MessageLevel::MultiMC));
|
||||
}
|
||||
|
||||
// check java
|
||||
@ -806,7 +806,7 @@ std::shared_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPtr s
|
||||
if(getPreLaunchCommand().size())
|
||||
{
|
||||
auto step = std::make_shared<PreLaunchCommand>(pptr);
|
||||
step->setWorkingDirectory(minecraftRoot());
|
||||
step->setWorkingDirectory(gameRoot());
|
||||
process->appendStep(step);
|
||||
}
|
||||
|
||||
@ -851,14 +851,14 @@ std::shared_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPtr s
|
||||
if(method == "LauncherPart")
|
||||
{
|
||||
auto step = std::make_shared<LauncherPartLaunch>(pptr);
|
||||
step->setWorkingDirectory(minecraftRoot());
|
||||
step->setWorkingDirectory(gameRoot());
|
||||
step->setAuthSession(session);
|
||||
process->appendStep(step);
|
||||
}
|
||||
else if (method == "DirectJava")
|
||||
{
|
||||
auto step = std::make_shared<DirectJavaLaunch>(pptr);
|
||||
step->setWorkingDirectory(minecraftRoot());
|
||||
step->setWorkingDirectory(gameRoot());
|
||||
step->setAuthSession(session);
|
||||
process->appendStep(step);
|
||||
}
|
||||
@ -868,7 +868,7 @@ std::shared_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPtr s
|
||||
if(getPostExitCommand().size())
|
||||
{
|
||||
auto step = std::make_shared<PostLaunchCommand>(pptr);
|
||||
step->setWorkingDirectory(minecraftRoot());
|
||||
step->setWorkingDirectory(gameRoot());
|
||||
process->appendStep(step);
|
||||
}
|
||||
if (session)
|
||||
|
@ -49,10 +49,18 @@ public:
|
||||
QDir librariesPath() const;
|
||||
QDir versionsPath() const;
|
||||
QString instanceConfigFolder() const override;
|
||||
QString minecraftRoot() const; // Path to the instance's minecraft directory.
|
||||
QString binRoot() const; // Path to the instance's minecraft bin directory.
|
||||
QString getNativePath() const; // where to put the natives during/before launch
|
||||
QString getLocalLibraryPath() const; // where the instance-local libraries should be
|
||||
|
||||
// Path to the instance's minecraft directory.
|
||||
QString gameRoot() const override;
|
||||
|
||||
// Path to the instance's minecraft bin directory.
|
||||
QString binRoot() const;
|
||||
|
||||
// where to put the natives during/before launch
|
||||
QString getNativePath() const;
|
||||
|
||||
// where the instance-local libraries should be
|
||||
QString getLocalLibraryPath() const;
|
||||
|
||||
|
||||
////// Profile management //////
|
||||
|
@ -11,7 +11,7 @@ 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")))
|
||||
if(!FS::ensureFolderPathExists(FS::PathCombine(minecraftInstance->gameRoot(), "server-resource-packs")))
|
||||
{
|
||||
emit logLine(tr("Couldn't create the 'server-resource-packs' folder"), MessageLevel::Error);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ QList<Mod> LegacyInstance::getJarMods() const
|
||||
return jarModList()->allMods();
|
||||
}
|
||||
|
||||
QString LegacyInstance::minecraftRoot() const
|
||||
QString LegacyInstance::gameRoot() const
|
||||
{
|
||||
QFileInfo mcDir(FS::PathCombine(instanceRoot(), "minecraft"));
|
||||
QFileInfo dotMCDir(FS::PathCombine(instanceRoot(), ".minecraft"));
|
||||
@ -125,7 +125,7 @@ QString LegacyInstance::minecraftRoot() const
|
||||
|
||||
QString LegacyInstance::binRoot() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "bin");
|
||||
return FS::PathCombine(gameRoot(), "bin");
|
||||
}
|
||||
|
||||
QString LegacyInstance::jarModsDir() const
|
||||
@ -135,31 +135,31 @@ QString LegacyInstance::jarModsDir() const
|
||||
|
||||
QString LegacyInstance::libDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "lib");
|
||||
return FS::PathCombine(gameRoot(), "lib");
|
||||
}
|
||||
|
||||
QString LegacyInstance::savesDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "saves");
|
||||
return FS::PathCombine(gameRoot(), "saves");
|
||||
}
|
||||
|
||||
QString LegacyInstance::loaderModsDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "mods");
|
||||
return FS::PathCombine(gameRoot(), "mods");
|
||||
}
|
||||
|
||||
QString LegacyInstance::coreModsDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "coremods");
|
||||
return FS::PathCombine(gameRoot(), "coremods");
|
||||
}
|
||||
|
||||
QString LegacyInstance::resourceDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "resources");
|
||||
return FS::PathCombine(gameRoot(), "resources");
|
||||
}
|
||||
QString LegacyInstance::texturePacksDir() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "texturepacks");
|
||||
return FS::PathCombine(gameRoot(), "texturepacks");
|
||||
}
|
||||
|
||||
QString LegacyInstance::runnableJar() const
|
||||
@ -174,7 +174,7 @@ QString LegacyInstance::modListFile() const
|
||||
|
||||
QString LegacyInstance::instanceConfigFolder() const
|
||||
{
|
||||
return FS::PathCombine(minecraftRoot(), "config");
|
||||
return FS::PathCombine(gameRoot(), "config");
|
||||
}
|
||||
|
||||
bool LegacyInstance::shouldRebuild() const
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
QString coreModsDir() const;
|
||||
QString resourceDir() const;
|
||||
virtual QString instanceConfigFolder() const override;
|
||||
QString minecraftRoot() const; // Path to the instance's minecraft directory.
|
||||
QString gameRoot() const; // Path to the instance's minecraft directory.
|
||||
QString binRoot() const; // Path to the instance's minecraft bin directory.
|
||||
|
||||
/// Get the curent base jar of this instance. By default, it's the
|
||||
@ -123,7 +123,7 @@ public:
|
||||
}
|
||||
QString getLogFileRoot() override
|
||||
{
|
||||
return minecraftRoot();
|
||||
return gameRoot();
|
||||
}
|
||||
|
||||
QString getStatusbarDescription() override;
|
||||
|
@ -126,7 +126,7 @@ void LegacyUpgradeTask::copyFinished()
|
||||
QStringList rootRemovables = {"modlist", "version", "instMods"};
|
||||
QStringList mcRemovables = {"bin", "MultiMCLauncher.jar", "icon.png"};
|
||||
removeAll(inst.instanceRoot(), rootRemovables);
|
||||
removeAll(inst.minecraftRoot(), mcRemovables);
|
||||
removeAll(inst.gameRoot(), mcRemovables);
|
||||
}
|
||||
emitSucceeded();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ FoldersTask::FoldersTask(MinecraftInstance * inst)
|
||||
void FoldersTask::executeTask()
|
||||
{
|
||||
// Make directories
|
||||
QDir mcDir(m_inst->minecraftRoot());
|
||||
QDir mcDir(m_inst->gameRoot());
|
||||
if (!mcDir.exists() && !mcDir.mkpath("."))
|
||||
{
|
||||
emitFailed(tr("Failed to create folder for minecraft binaries."));
|
||||
|
Reference in New Issue
Block a user