diff options
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/classparser/CMakeLists.txt | 11 | ||||
-rw-r--r-- | libraries/classparser/include/classparser.h (renamed from libraries/classparser/include/javautils.h) | 4 | ||||
-rw-r--r-- | libraries/classparser/src/classparser.cpp (renamed from libraries/classparser/src/javautils.cpp) | 8 |
3 files changed, 12 insertions, 11 deletions
diff --git a/libraries/classparser/CMakeLists.txt b/libraries/classparser/CMakeLists.txt index a6c3fa14..db266f53 100644 --- a/libraries/classparser/CMakeLists.txt +++ b/libraries/classparser/CMakeLists.txt @@ -18,7 +18,7 @@ include_directories(${Qt5Base_INCLUDE_DIRS}) set(CLASSPARSER_HEADERS # Public headers include/classparser_config.h -include/javautils.h +include/classparser.h # Private headers src/annotations.h @@ -30,12 +30,13 @@ src/membuffer.h ) set(CLASSPARSER_SOURCES -src/javautils.cpp +src/classparser.cpp src/annotations.cpp ) add_definitions(-DCLASSPARSER_LIBRARY) -add_library(classparser SHARED ${CLASSPARSER_SOURCES} ${CLASSPARSER_HEADERS}) -target_include_directories(classparser PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -qt5_use_modules(classparser Core) +add_library(MultiMC_classparser STATIC ${CLASSPARSER_SOURCES} ${CLASSPARSER_HEADERS}) +target_include_directories(MultiMC_classparser PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") +target_link_libraries(MultiMC_classparser MultiMC_quazip) +qt5_use_modules(MultiMC_classparser Core) diff --git a/libraries/classparser/include/javautils.h b/libraries/classparser/include/classparser.h index aad7b504..7ce3f24a 100644 --- a/libraries/classparser/include/javautils.h +++ b/libraries/classparser/include/classparser.h @@ -18,9 +18,7 @@ #include <QString> #include "classparser_config.h" -#define MCVer_Unknown "Unknown" - -namespace javautils +namespace classparser { /** * @brief Get the version from a minecraft.jar by parsing its class files. Expensive! diff --git a/libraries/classparser/src/javautils.cpp b/libraries/classparser/src/classparser.cpp index 719032af..ebbdc887 100644 --- a/libraries/classparser/src/javautils.cpp +++ b/libraries/classparser/src/classparser.cpp @@ -15,17 +15,18 @@ * limitations under the License. */ #include "classfile.h" -#include "javautils.h" +#include "classparser.h" #include <QFile> #include <quazipfile.h> +#include <QDebug> -namespace javautils +namespace classparser { QString GetMinecraftJarVersion(QString jarName) { - QString version = MCVer_Unknown; + QString version; // check if minecraft.jar exists QFile jar(jarName); @@ -61,6 +62,7 @@ QString GetMinecraftJarVersion(QString jarName) if (constant.type != java::constant::j_string_data) continue; const std::string &str = constant.str_data; + qDebug() << QString::fromStdString(str); if (str.compare(0, 20, "Minecraft Minecraft ") == 0) { version = str.substr(20).data(); |