mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-13 05:37:42 +02:00
cleanup the mod name checking
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -196,10 +196,7 @@ Task* ModFolderModel::createParseTask(Resource& resource)
|
||||
bool ModFolderModel::uninstallMod(const QString& filename, bool preserve_metadata)
|
||||
{
|
||||
for (auto mod : allMods()) {
|
||||
auto modfilename = mod->fileinfo().fileName();
|
||||
if (!mod->enabled() && modfilename.endsWith(".disabled"))
|
||||
modfilename.chop(9);
|
||||
if (modfilename == filename) {
|
||||
if (mod->getOriginalFileName() == filename) {
|
||||
auto index_dir = indexDir();
|
||||
mod->destroy(index_dir, preserve_metadata, false);
|
||||
|
||||
|
@ -169,3 +169,11 @@ bool Resource::isMoreThanOneHardLink() const
|
||||
{
|
||||
return FS::hardLinkCount(m_file_info.absoluteFilePath()) > 1;
|
||||
}
|
||||
|
||||
auto Resource::getOriginalFileName() const -> QString
|
||||
{
|
||||
auto fileName = m_file_info.fileName();
|
||||
if (!m_enabled)
|
||||
fileName.chop(9);
|
||||
return fileName;
|
||||
}
|
@ -45,6 +45,7 @@ class Resource : public QObject {
|
||||
[[nodiscard]] auto internal_id() const -> QString { return m_internal_id; }
|
||||
[[nodiscard]] auto type() const -> ResourceType { return m_type; }
|
||||
[[nodiscard]] bool enabled() const { return m_enabled; }
|
||||
[[nodiscard]] auto getOriginalFileName() const -> QString;
|
||||
|
||||
[[nodiscard]] virtual auto name() const -> QString { return m_name; }
|
||||
[[nodiscard]] virtual bool valid() const { return m_type != ResourceType::UNKNOWN; }
|
||||
|
Reference in New Issue
Block a user