From f71479ec33562c9a0ebbdb335bef5e2824a12710 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 20 Feb 2013 08:32:26 -0600 Subject: Added stdinstance plugin and a ton of plugin stuff. --- plugins/stdinstance/stdinstancetype.cpp | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugins/stdinstance/stdinstancetype.cpp (limited to 'plugins/stdinstance/stdinstancetype.cpp') diff --git a/plugins/stdinstance/stdinstancetype.cpp b/plugins/stdinstance/stdinstancetype.cpp new file mode 100644 index 00000000..3e9e00a0 --- /dev/null +++ b/plugins/stdinstance/stdinstancetype.cpp @@ -0,0 +1,34 @@ +/* Copyright 2013 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. + */ + +#include "stdinstancetype.h" + +StdInstanceType::StdInstanceType(QObject *parent) : + InstanceType(parent) +{ + +} + +InstanceLoader::InstTypeError StdInstanceType::createInstance(Instance *inst, + const QString &instDir) const +{ + return InstanceLoader::NoError; +} + +InstanceLoader::InstTypeError StdInstanceType::loadInstance(Instance *inst, + const QString &instDir) const +{ + return InstanceLoader::NoError; +} -- cgit v1.2.3 From dd2e836b4cf4cfa043f9ea2911f58f1d22d4e282 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 20 Feb 2013 19:10:09 -0600 Subject: Split MultiMC up into a few separate libraries. Fixed plugin system. Tons of other stuff... --- plugins/stdinstance/stdinstancetype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/stdinstance/stdinstancetype.cpp') diff --git a/plugins/stdinstance/stdinstancetype.cpp b/plugins/stdinstance/stdinstancetype.cpp index 3e9e00a0..9b7aa994 100644 --- a/plugins/stdinstance/stdinstancetype.cpp +++ b/plugins/stdinstance/stdinstancetype.cpp @@ -16,7 +16,7 @@ #include "stdinstancetype.h" StdInstanceType::StdInstanceType(QObject *parent) : - InstanceType(parent) + QObject(parent) { } -- cgit v1.2.3 From f3b6eeeac4e1606a288c7f12fec271fbb7f120f6 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 20 Feb 2013 19:45:00 -0600 Subject: Got instance loading working. --- plugins/stdinstance/stdinstancetype.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'plugins/stdinstance/stdinstancetype.cpp') diff --git a/plugins/stdinstance/stdinstancetype.cpp b/plugins/stdinstance/stdinstancetype.cpp index 9b7aa994..5a3a6649 100644 --- a/plugins/stdinstance/stdinstancetype.cpp +++ b/plugins/stdinstance/stdinstancetype.cpp @@ -15,20 +15,44 @@ #include "stdinstancetype.h" +#include +#include + +#include "stdinstance.h" + StdInstanceType::StdInstanceType(QObject *parent) : QObject(parent) { } -InstanceLoader::InstTypeError StdInstanceType::createInstance(Instance *inst, +InstanceLoader::InstTypeError StdInstanceType::createInstance(Instance *&inst, const QString &instDir) const { + QFileInfo rootDir(instDir); + + if (!rootDir.exists() && !QDir().mkdir(rootDir.path())) + { + return InstanceLoader::CantCreateDir; + } + + StdInstance *stdInst = new StdInstance(instDir); + + // TODO: Verify that the instance is valid. + + inst = stdInst; + return InstanceLoader::NoError; } -InstanceLoader::InstTypeError StdInstanceType::loadInstance(Instance *inst, +InstanceLoader::InstTypeError StdInstanceType::loadInstance(Instance *&inst, const QString &instDir) const { + StdInstance *stdInst = new StdInstance(instDir); + + // TODO: Verify that the instance is valid. + + inst = stdInst; + return InstanceLoader::NoError; } -- cgit v1.2.3