mirror of
https://github.com/ModOrganizer2/modorganizer-installer_bundle.git
synced 2026-07-27 14:02:39 -07:00
Compare commits
37
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
004135b33d | ||
|
|
17fa43b0c1 | ||
|
|
9633afaeed | ||
|
|
122c3d275c | ||
|
|
cef3001f30 | ||
|
|
74f9eb6241 | ||
|
|
4f4b3a0068 | ||
|
|
aa7f56f1de | ||
|
|
64982ed25f | ||
|
|
d4f562041e | ||
|
|
8e971e8c3e | ||
|
|
bc0465f4dc | ||
|
|
6a28610a4d | ||
|
|
ab61d00c64 | ||
|
|
f449bd3afe | ||
|
|
7222892a10 | ||
|
|
00c515bace | ||
|
|
b7d1d4fe9b | ||
|
|
0b6b898edf | ||
|
|
9c1fb3cb21 | ||
|
|
a6085f8ecc | ||
|
|
907c61cd6f | ||
|
|
e86aed98db | ||
|
|
2af8182e4f | ||
|
|
ce0063bd50 | ||
|
|
f509d34693 | ||
|
|
4eef76e09c | ||
|
|
4fd0260f62 | ||
|
|
eaa12dddf2 | ||
|
|
131c91099b | ||
|
|
45b3e8b099 | ||
|
|
92c42d3545 | ||
|
|
64dc934891 | ||
|
|
87d1421dd7 | ||
|
|
31052f53b2 | ||
|
|
d81a26aef0 | ||
|
|
d2ee67f6a9 |
@@ -0,0 +1,5 @@
|
||||
edit
|
||||
CMakeLists.txt.user
|
||||
/msbuild.log
|
||||
/*std*.log
|
||||
/*build
|
||||
@@ -0,0 +1,14 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
|
||||
|
||||
ADD_COMPILE_OPTIONS($<$<CXX_COMPILER_ID:MSVC>:/MP> $<$<CXX_COMPILER_ID:MSVC>:$<$<CONFIG:RELEASE>:/O2>> $<$<CXX_COMPILER_ID:MSVC>:$<$<CONFIG:RELWITHDEBINFO>:/O2>>)
|
||||
|
||||
SET(PROJ_NAME installer_bundle)
|
||||
|
||||
PROJECT(${PROJ_NAME})
|
||||
|
||||
SET(DEPENDENCIES_DIR CACHE PATH "")
|
||||
|
||||
# hint to find qt in dependencies path
|
||||
LIST(APPEND CMAKE_PREFIX_PATH ${QT_ROOT}/lib/cmake)
|
||||
|
||||
ADD_SUBDIRECTORY(src)
|
||||
@@ -0,0 +1,32 @@
|
||||
version: 1.0.{build}
|
||||
skip_branch_with_pr: true
|
||||
image: Visual Studio 2019
|
||||
environment:
|
||||
WEBHOOK_URL:
|
||||
secure: gOKbXaZM9ImtMD5XrYITvdyZUW/az082G9OIN1EC1Vbg57wBaeLhi49uGjxPw5GVujHku6kxN6ab89zhbS5GVeluR76GM83IbKV4Sh7udXzoYZZdg6YudtYHzdhCgUeiedpswbuczTq9ceIkkfSEWZuh/lMAAVVwvcGsJAnoPFw=
|
||||
build_script:
|
||||
- cmd: >-
|
||||
git clone --depth=1 --branch=%APPVEYOR_REPO_BRANCH% https://github.com/ModOrganizer2/modorganizer-umbrella.git c:\projects\modorganizer-umbrella 2> $null
|
||||
|
||||
mkdir c:\projects\modorganizer-build -type directory
|
||||
|
||||
cd c:\projects\modorganizer-umbrella
|
||||
|
||||
C:\Python37-x64\python.exe unimake.py -d c:\projects\modorganizer-build -s Appveyor_Build=True %APPVEYOR_PROJECT_NAME%
|
||||
artifacts:
|
||||
- path: build\src\installer_bundle.dll
|
||||
name: installer_bundle_dll
|
||||
- path: build\src\installer_bundle.pdb
|
||||
name: installer_bundle_pdb
|
||||
- path: build\src\installer_bundle.lib
|
||||
name: installer_bundle_lib
|
||||
on_success:
|
||||
- ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER
|
||||
- ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1
|
||||
- ps: ./send.ps1 success $env:WEBHOOK_URL
|
||||
on_failure:
|
||||
- ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER
|
||||
- ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stdout.log
|
||||
- ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stderr.log
|
||||
- ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1
|
||||
- ps: ./send.ps1 failure $env:WEBHOOK_URL
|
||||
@@ -0,0 +1,63 @@
|
||||
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.11)
|
||||
|
||||
CMAKE_POLICY(SET CMP0020 NEW)
|
||||
CMAKE_POLICY(SET CMP0043 NEW)
|
||||
|
||||
FILE(GLOB ${PROJ_NAME}_SRCS *.cpp)
|
||||
FILE(GLOB ${PROJ_NAME}_HDRS *.h)
|
||||
FILE(GLOB ${PROJ_NAME}_FORMS *.ui)
|
||||
|
||||
|
||||
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
SET(CMAKE_AUTOUIC ON)
|
||||
FIND_PACKAGE(Qt5Widgets REQUIRED)
|
||||
QT5_WRAP_UI(${PROJ_NAME}_UIHDRS ${${PROJ_NAME}_FORMS})
|
||||
FIND_PACKAGE(Qt5LinguistTools)
|
||||
QT5_CREATE_TRANSLATION(${PROJ_NAME}_translations_qm ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/${PROJ_NAME}_en.ts)
|
||||
|
||||
SET(Boost_USE_STATIC_LIBS ON)
|
||||
SET(Boost_USE_MULTITHREADED ON)
|
||||
SET(Boost_USE_STATIC_RUNTIME OFF)
|
||||
FIND_PACKAGE(Boost)
|
||||
|
||||
IF (Boost_FOUND)
|
||||
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
|
||||
ENDIF (Boost_FOUND)
|
||||
|
||||
SET(default_project_path "${DEPENDENCIES_DIR}/modorganizer_super")
|
||||
GET_FILENAME_COMPONENT(${default_project_path} ${default_project_path} REALPATH)
|
||||
|
||||
SET(project_path "${default_project_path}" CACHE PATH "path to the other mo projects")
|
||||
SET(lib_path "${project_path}/../../install/libs")
|
||||
|
||||
INCLUDE_DIRECTORIES(${project_path}/uibase/src)
|
||||
LINK_DIRECTORIES(${lib_path})
|
||||
|
||||
|
||||
ADD_LIBRARY(${PROJ_NAME} SHARED ${${PROJ_NAME}_HDRS} ${${PROJ_NAME}_SRCS} ${${PROJ_NAME}_UIHDRS} ${${PROJ_NAME}_translations_qm})
|
||||
TARGET_LINK_LIBRARIES(${PROJ_NAME}
|
||||
Qt5::Widgets
|
||||
${Boost_LIBRARIES}
|
||||
uibase)
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(${PROJ_NAME} PROPERTIES LINK_FLAGS "/LARGEADDRESSAWARE")
|
||||
ELSE(MSVC)
|
||||
SET_TARGET_PROPERTIES(${PROJ_NAME} PROPERTIES LINK_FLAGS "-std=c++11")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF (NOT "${OPTIMIZE_COMPILE_FLAGS}" STREQUAL "")
|
||||
SET_TARGET_PROPERTIES(${PROJ_NAME} PROPERTIES COMPILE_FLAGS_RELWITHDEBINFO ${OPTIMIZE_COMPILE_FLAGS})
|
||||
ENDIF()
|
||||
IF (NOT "${OPTIMIZE_LINK_FLAGS}" STREQUAL "")
|
||||
SET_TARGET_PROPERTIES(${PROJ_NAME} PROPERTIES LINK_FLAGS_RELWITHDEBINFO ${OPTIMIZE_LINK_FLAGS})
|
||||
ENDIF()
|
||||
|
||||
###############
|
||||
## Installation
|
||||
|
||||
INSTALL(TARGETS ${PROJ_NAME}
|
||||
RUNTIME DESTINATION bin/plugins)
|
||||
INSTALL(FILES $<TARGET_PDB_FILE:${PROJ_NAME}>
|
||||
DESTINATION pdb)
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US">
|
||||
<context>
|
||||
<name>InstallerBundle</name>
|
||||
<message>
|
||||
<location filename="installerbundle.cpp" line="50"/>
|
||||
<source>Proxy-Installer to handle bundles containing the actual mod archive</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
+135
-119
@@ -1,119 +1,135 @@
|
||||
/*
|
||||
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
|
||||
|
||||
This file is part of Mod Organizer.
|
||||
|
||||
Mod Organizer is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Mod Organizer is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "installerbundle.h"
|
||||
#include "iinstallationmanager.h"
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
|
||||
using namespace MOBase;
|
||||
|
||||
|
||||
InstallerBundle::InstallerBundle()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool InstallerBundle::init(IOrganizer*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QString InstallerBundle::name() const
|
||||
{
|
||||
return "Bundle Installer";
|
||||
}
|
||||
|
||||
QString InstallerBundle::author() const
|
||||
{
|
||||
return "Tannin";
|
||||
}
|
||||
|
||||
QString InstallerBundle::description() const
|
||||
{
|
||||
return tr("Proxy-Installer to handle bundles containing the actual mod archive");
|
||||
}
|
||||
|
||||
VersionInfo InstallerBundle::version() const
|
||||
{
|
||||
return VersionInfo(1, 0, 0, VersionInfo::RELEASE_FINAL);
|
||||
}
|
||||
|
||||
bool InstallerBundle::isActive() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<PluginSetting> InstallerBundle::settings() const
|
||||
{
|
||||
return QList<PluginSetting>();
|
||||
}
|
||||
|
||||
unsigned int InstallerBundle::priority() const
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
bool InstallerBundle::isManualInstaller() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InstallerBundle::isArchiveSupported(const DirectoryTree &tree) const
|
||||
{
|
||||
for (DirectoryTree::const_leaf_iterator fileIter = tree.leafsBegin();
|
||||
fileIter != tree.leafsEnd(); ++fileIter) {
|
||||
if (fileIter->getName().endsWith(".fomod", Qt::CaseInsensitive)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ((tree.numNodes() == 0)
|
||||
&& (tree.numLeafs() == 1)
|
||||
&& (tree.leafsBegin()->getName().endsWith(".7z", Qt::CaseInsensitive)
|
||||
|| tree.leafsBegin()->getName().endsWith(".rar", Qt::CaseInsensitive))) {
|
||||
// nested archive
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
IPluginInstaller::EInstallResult InstallerBundle::install(GuessedValue<QString> &modName, DirectoryTree &tree,
|
||||
QString&, int&)
|
||||
{
|
||||
for (DirectoryTree::const_leaf_iterator fileIter = tree.leafsBegin();
|
||||
fileIter != tree.leafsEnd(); ++fileIter) {
|
||||
QString name = fileIter->getName();
|
||||
if (name.endsWith(".fomod", Qt::CaseInsensitive)
|
||||
|| name.endsWith(".7z", Qt::CaseInsensitive)
|
||||
|| name.endsWith(".rar", Qt::CaseInsensitive)) {
|
||||
QString tempFile = manager()->extractFile(fileIter->getName());
|
||||
IPluginInstaller::EInstallResult res = manager()->installArchive(modName, tempFile);
|
||||
if (res == IPluginInstaller::RESULT_SUCCESS) {
|
||||
res = IPluginInstaller::RESULT_SUCCESSCANCEL;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return IPluginInstaller::RESULT_NOTATTEMPTED;
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
Q_EXPORT_PLUGIN2(installerBundle, InstallerBundle)
|
||||
#endif
|
||||
/*
|
||||
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
|
||||
|
||||
This file is part of Mod Organizer.
|
||||
|
||||
Mod Organizer is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Mod Organizer is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "installerbundle.h"
|
||||
#include "iinstallationmanager.h"
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
using namespace MOBase;
|
||||
|
||||
|
||||
InstallerBundle::InstallerBundle()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool InstallerBundle::init(IOrganizer*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QString InstallerBundle::name() const
|
||||
{
|
||||
return "Bundle Installer";
|
||||
}
|
||||
|
||||
QString InstallerBundle::author() const
|
||||
{
|
||||
return "Tannin";
|
||||
}
|
||||
|
||||
QString InstallerBundle::description() const
|
||||
{
|
||||
return tr("Proxy-Installer to handle bundles containing the actual mod archive");
|
||||
}
|
||||
|
||||
VersionInfo InstallerBundle::version() const
|
||||
{
|
||||
return VersionInfo(1, 1, 0, VersionInfo::RELEASE_FINAL);
|
||||
}
|
||||
|
||||
bool InstallerBundle::isActive() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<PluginSetting> InstallerBundle::settings() const
|
||||
{
|
||||
return QList<PluginSetting>();
|
||||
}
|
||||
|
||||
unsigned int InstallerBundle::priority() const
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
bool InstallerBundle::isManualInstaller() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InstallerBundle::findObject(DirectoryTree const *tree) const
|
||||
{
|
||||
for (;;) {
|
||||
DirectoryTree::const_leaf_iterator fileIter = tree->leafsBegin();
|
||||
|
||||
//Really truly we should use the supported extensions from the installation
|
||||
//manager here
|
||||
if (tree->numNodes() == 0 && tree->numLeafs() == 1 &&
|
||||
(fileIter->getName().endsWith(".7z") ||
|
||||
fileIter->getName().endsWith(".zip") ||
|
||||
fileIter->getName().endsWith(".rar"))) {
|
||||
// nested archive
|
||||
m_found_dir = tree;
|
||||
m_found_leaf = fileIter;
|
||||
return true;
|
||||
}
|
||||
|
||||
for (; fileIter != tree->leafsEnd(); ++fileIter) {
|
||||
if (fileIter->getName().endsWith(".fomod")) {
|
||||
m_found_dir = tree;
|
||||
m_found_leaf = fileIter;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//Arguably this should also check the name of the directory we're looking at
|
||||
//is the same as the module name
|
||||
if (tree->numNodes() != 1) {
|
||||
return false;
|
||||
}
|
||||
tree = *(tree->nodesBegin());
|
||||
}
|
||||
}
|
||||
|
||||
bool InstallerBundle::isArchiveSupported(const DirectoryTree &tree) const
|
||||
{
|
||||
return findObject(&tree);
|
||||
}
|
||||
|
||||
IPluginInstaller::EInstallResult InstallerBundle::install(GuessedValue<QString> &modName,
|
||||
DirectoryTree &tree,
|
||||
QString&, int &modId)
|
||||
{
|
||||
if (! findObject(&tree)) {
|
||||
return IPluginInstaller::RESULT_NOTATTEMPTED;
|
||||
}
|
||||
FileNameString name = m_found_dir->getFullPath(&(*m_found_leaf));
|
||||
QString tempFile = manager()->extractFile(name.toQString());
|
||||
IPluginInstaller::EInstallResult res = manager()->installArchive(modName, tempFile, modId);
|
||||
if (res == IPluginInstaller::RESULT_SUCCESS) {
|
||||
res = IPluginInstaller::RESULT_SUCCESSCANCEL;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
Q_EXPORT_PLUGIN2(installerBundle, InstallerBundle)
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iplugininstallersimple.h>
|
||||
|
||||
|
||||
class InstallerBundle : public MOBase::IPluginInstallerSimple
|
||||
{
|
||||
|
||||
@@ -49,8 +48,16 @@ public:
|
||||
virtual bool isManualInstaller() const;
|
||||
|
||||
virtual bool isArchiveSupported(const MOBase::DirectoryTree &tree) const;
|
||||
virtual EInstallResult install(MOBase::GuessedValue<QString> &modName, MOBase::DirectoryTree &tree,
|
||||
virtual EInstallResult install(MOBase::GuessedValue<QString> &modName,
|
||||
MOBase::DirectoryTree &tree,
|
||||
QString &version, int &modID);
|
||||
|
||||
private:
|
||||
//Stash the results of findObject.
|
||||
//FIXME return a tuple?
|
||||
mutable MOBase::DirectoryTree const *m_found_dir;
|
||||
mutable MOBase::DirectoryTree::const_leaf_iterator m_found_leaf;
|
||||
bool findObject(MOBase::DirectoryTree const *tree) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user