mirror of
https://github.com/ModOrganizer2/modorganizer-installer_bundle.git
synced 2026-07-27 14:02:39 -07:00
Compare commits
54
Commits
release_v1.2.1
...
2_3_0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea3d31fe71 | ||
|
|
289663f1cd | ||
|
|
7fc63ddfd7 | ||
|
|
b3f9d0c575 | ||
|
|
2c7e8a417a | ||
|
|
aae2c898f0 | ||
|
|
9bb9c301c4 | ||
|
|
558a806ea8 | ||
|
|
1e1f77ce55 | ||
|
|
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 | ||
|
|
4b1dd8fb81 | ||
|
|
17c3bc3450 | ||
|
|
8f9b8cf564 | ||
|
|
6ef78cf305 | ||
|
|
729a2d2856 | ||
|
|
dc7d96ec8e | ||
|
|
6797d50370 | ||
|
|
1e359abd46 |
@@ -0,0 +1,5 @@
|
||||
edit
|
||||
CMakeLists.txt.user
|
||||
/msbuild.log
|
||||
/*std*.log
|
||||
/*build
|
||||
@@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(installer_bundle)
|
||||
set(project_type plugin)
|
||||
set(enable_warnings OFF)
|
||||
|
||||
if(DEFINED DEPENDENCIES_DIR)
|
||||
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/project.cmake)
|
||||
else()
|
||||
include(../cmake_common/project.cmake)
|
||||
endif()
|
||||
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,6 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
if(DEFINED DEPENDENCIES_DIR)
|
||||
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/src.cmake)
|
||||
else()
|
||||
include(../../cmake_common/src.cmake)
|
||||
endif()
|
||||
@@ -0,0 +1,15 @@
|
||||
Import('qt_env')
|
||||
|
||||
env = qt_env.Clone()
|
||||
|
||||
env.DisableQtModules('Gui')
|
||||
env.AppendUnique(CPPDEFINES = [ 'INSTALLERBUNDLE_LIBRARY' ])
|
||||
|
||||
# Sigh
|
||||
env['CPPPATH'] += [ '.' ]
|
||||
|
||||
lib = env.SharedLibrary('installerBundle', env.Glob('*.cpp'))
|
||||
env.InstallModule(lib)
|
||||
|
||||
res = env['QT_USED_MODULES']
|
||||
Return('res')
|
||||
@@ -27,4 +27,5 @@ HEADERS += installerbundle.h
|
||||
include(../plugin_template.pri)
|
||||
|
||||
OTHER_FILES += \
|
||||
installerbundle.json
|
||||
installerbundle.json\
|
||||
SConscript
|
||||
|
||||
@@ -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>
|
||||
+42
-30
@@ -22,7 +22,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
|
||||
using namespace MOBase;
|
||||
|
||||
|
||||
@@ -53,7 +52,7 @@ QString InstallerBundle::description() const
|
||||
|
||||
VersionInfo InstallerBundle::version() const
|
||||
{
|
||||
return VersionInfo(1, 0, 0, VersionInfo::RELEASE_FINAL);
|
||||
return VersionInfo(1, 1, 0, VersionInfo::RELEASE_FINAL);
|
||||
}
|
||||
|
||||
bool InstallerBundle::isActive() const
|
||||
@@ -76,42 +75,55 @@ bool InstallerBundle::isManualInstaller() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InstallerBundle::isArchiveSupported(const DirectoryTree &tree) const
|
||||
std::shared_ptr<const FileTreeEntry> InstallerBundle::findObject(std::shared_ptr<const IFileTree> tree) const
|
||||
{
|
||||
for (DirectoryTree::const_leaf_iterator fileIter = tree.leafsBegin();
|
||||
fileIter != tree.leafsEnd(); ++fileIter) {
|
||||
if (fileIter->getName().endsWith(".fomod", Qt::CaseInsensitive)) {
|
||||
return true;
|
||||
// Check if we have an archive:
|
||||
auto managerExtensions = manager()->getSupportedExtensions();
|
||||
|
||||
// Look for a file with a valid extension:
|
||||
int nDirs = 0;
|
||||
for (auto entry : *tree) {
|
||||
if (entry->isFile()) {
|
||||
if (managerExtensions.contains(entry->suffix(), FileNameComparator::CaseSensitivity)) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nDirs++;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
// Arguably this should also check the name of the directory we're looking at
|
||||
// is the same as the module name:
|
||||
if (nDirs != 1) {
|
||||
return nullptr;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Retrieve the first folder which is the first item:
|
||||
return findObject(tree->at(0)->astree());
|
||||
}
|
||||
|
||||
IPluginInstaller::EInstallResult InstallerBundle::install(GuessedValue<QString> &modName, DirectoryTree &tree,
|
||||
QString&, int&)
|
||||
bool InstallerBundle::isArchiveSupported(std::shared_ptr<const IFileTree> tree) const
|
||||
{
|
||||
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 findObject(tree) != nullptr;
|
||||
}
|
||||
|
||||
IPluginInstaller::EInstallResult InstallerBundle::install(
|
||||
GuessedValue<QString>& modName, std::shared_ptr<IFileTree>& tree, QString&, int &modId)
|
||||
{
|
||||
// Find a valid "object":
|
||||
auto entry = findObject(tree);
|
||||
if (entry == nullptr) {
|
||||
return IPluginInstaller::RESULT_NOTATTEMPTED;
|
||||
}
|
||||
return IPluginInstaller::RESULT_NOTATTEMPTED;
|
||||
|
||||
// Extract it:
|
||||
QString tempFile = manager()->extractFile(entry);
|
||||
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)
|
||||
|
||||
+68
-57
@@ -1,57 +1,68 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef INSTALLERBUNDLE_H
|
||||
#define INSTALLERBUNDLE_H
|
||||
|
||||
|
||||
#include <iplugininstallersimple.h>
|
||||
|
||||
|
||||
class InstallerBundle : public MOBase::IPluginInstallerSimple
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerSimple)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
Q_PLUGIN_METADATA(IID "org.tannin.InstallerBundle" FILE "installerbundle.json")
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
InstallerBundle();
|
||||
|
||||
virtual bool init(MOBase::IOrganizer *moInfo);
|
||||
virtual QString name() const;
|
||||
virtual QString author() const;
|
||||
virtual QString description() const;
|
||||
virtual MOBase::VersionInfo version() const;
|
||||
virtual bool isActive() const;
|
||||
virtual QList<MOBase::PluginSetting> settings() const;
|
||||
|
||||
virtual unsigned int priority() const;
|
||||
virtual bool isManualInstaller() const;
|
||||
|
||||
virtual bool isArchiveSupported(const MOBase::DirectoryTree &tree) const;
|
||||
virtual EInstallResult install(MOBase::GuessedValue<QString> &modName, MOBase::DirectoryTree &tree,
|
||||
QString &version, int &modID);
|
||||
};
|
||||
|
||||
|
||||
#endif // INSTALLERBUNDLE_H
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef INSTALLERBUNDLE_H
|
||||
#define INSTALLERBUNDLE_H
|
||||
|
||||
|
||||
#include <iplugininstallersimple.h>
|
||||
|
||||
class InstallerBundle : public MOBase::IPluginInstallerSimple
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerSimple)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
Q_PLUGIN_METADATA(IID "org.tannin.InstallerBundle" FILE "installerbundle.json")
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
InstallerBundle();
|
||||
|
||||
virtual bool init(MOBase::IOrganizer *moInfo);
|
||||
virtual QString name() const;
|
||||
virtual QString author() const;
|
||||
virtual QString description() const;
|
||||
virtual MOBase::VersionInfo version() const;
|
||||
virtual bool isActive() const;
|
||||
virtual QList<MOBase::PluginSetting> settings() const;
|
||||
|
||||
virtual unsigned int priority() const override;
|
||||
virtual bool isManualInstaller() const;
|
||||
|
||||
virtual bool isArchiveSupported(std::shared_ptr<const MOBase::IFileTree> tree) const override;
|
||||
virtual EInstallResult install(MOBase::GuessedValue<QString> &modName,
|
||||
std::shared_ptr<MOBase::IFileTree> &tree,
|
||||
QString &version, int &modID) override;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Find the first entry that can be extracted from this archive.
|
||||
*
|
||||
* @param tree The tree to look the entry in.
|
||||
*
|
||||
* @return the entry, if one was found, or a null pointer.
|
||||
*/
|
||||
std::shared_ptr<const MOBase::FileTreeEntry> findObject(std::shared_ptr<const MOBase::IFileTree> tree) const;
|
||||
};
|
||||
|
||||
|
||||
#endif // INSTALLERBUNDLE_H
|
||||
|
||||
Reference in New Issue
Block a user