fix FOMOD root level detection

This commit is contained in:
Limo
2025-05-03 11:00:07 +02:00
parent 9b805ab924
commit ffdb4f9b9e
5 changed files with 33 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
project(Limo VERSION 1.2.1 LANGUAGES CXX) project(Limo VERSION 1.2.2 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)

View File

@@ -41,6 +41,14 @@
<releases> <releases>
<release version="1.2.2" date="2025-05-03">
<description>
<p>Minor FOMOD fix</p>
<ul>
<li>Fixed root level detection for FOMOD</li>
</ul>
</description>
</release>
<release version="1.2.1" date="2025-05-02"> <release version="1.2.1" date="2025-05-02">
<description> <description>
<p>Root level detection improvements</p> <p>Root level detection improvements</p>

View File

@@ -1,6 +1,18 @@
{ {
"versions": "versions":
[ [
{
"version" : "1.2.2",
"date" : 1746262543,
"title" : "Minor FOMOD fix",
"changes" :
[
{
"type" : 2,
"short_description" : "Fixed root level detection for FOMOD"
}
]
},
{ {
"version" : "1.2.1", "version" : "1.2.1",
"date" : 1746216782, "date" : 1746216782,

View File

@@ -1,4 +1,4 @@
#pragma once #pragma once
constexpr char APP_VERSION[] = "1.2.1"; constexpr char APP_VERSION[] = "1.2.2";
constexpr char APP_INSTALL_PREFIX[] = "/usr/local"; constexpr char APP_INSTALL_PREFIX[] = "/usr/local";

View File

@@ -253,6 +253,7 @@ bool AddModDialog::setupDialog(const QStringList& deployers,
if(!info.version_overwrite.empty()) if(!info.version_overwrite.empty())
ui->version_text->setText(info.version_overwrite.c_str()); ui->version_text->setText(info.version_overwrite.c_str());
bool root_level_checked = false;
ui->installer_box->clear(); ui->installer_box->clear();
int root_level = 0; int root_level = 0;
std::string prefix; std::string prefix;
@@ -270,6 +271,7 @@ bool AddModDialog::setupDialog(const QStringList& deployers,
} }
if(detected_type == Installer::FOMODINSTALLER) if(detected_type == Installer::FOMODINSTALLER)
{ {
root_level_checked = true;
auto [name, version] = fomod::FomodInstaller::getMetaData(info.current_path / prefix); auto [name, version] = fomod::FomodInstaller::getMetaData(info.current_path / prefix);
if(!name.empty() && info.name_overwrite.empty()) if(!name.empty() && info.name_overwrite.empty())
ui->name_text->setText(name.c_str()); ui->name_text->setText(name.c_str());
@@ -361,15 +363,17 @@ bool AddModDialog::setupDialog(const QStringList& deployers,
return false; return false;
} }
bool root_level_checked = false; if(!root_level_checked)
for(const auto& condition : root_level_conditions)
{ {
if(auto level = condition.detectRootLevel(ui->content_tree->invisibleRootItem()); for(const auto& condition : root_level_conditions)
level && *level >= 0)
{ {
root_level_checked = true; if(auto level = condition.detectRootLevel(ui->content_tree->invisibleRootItem());
ui->root_level_box->setValue(std::min(std::max(0, *level), directory_tree_depth_ - 1)); level && *level >= 0)
break; {
root_level_checked = true;
ui->root_level_box->setValue(std::min(std::max(0, *level), directory_tree_depth_ - 1));
break;
}
} }
} }