fix: hide .index folder on Windows

This commit is contained in:
flow 2022-06-04 11:01:10 -03:00
parent 1ab00ca8b2
commit c2a43c6f40
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -22,6 +22,10 @@
#include "FileSystem.h" #include "FileSystem.h"
#include "minecraft/mod/MetadataHandler.h" #include "minecraft/mod/MetadataHandler.h"
#ifdef Q_OS_WIN32
#include <windows.h>
#endif
LocalModUpdateTask::LocalModUpdateTask(QDir index_dir, ModPlatform::IndexedPack& mod, ModPlatform::IndexedVersion& mod_version) LocalModUpdateTask::LocalModUpdateTask(QDir index_dir, ModPlatform::IndexedPack& mod, ModPlatform::IndexedVersion& mod_version)
: m_index_dir(index_dir), m_mod(mod), m_mod_version(mod_version) : m_index_dir(index_dir), m_mod(mod), m_mod_version(mod_version)
{ {
@ -29,6 +33,10 @@ LocalModUpdateTask::LocalModUpdateTask(QDir index_dir, ModPlatform::IndexedPack&
if (!FS::ensureFolderPathExists(index_dir.path())) { if (!FS::ensureFolderPathExists(index_dir.path())) {
emitFailed(QString("Unable to create index for mod %1!").arg(m_mod.name)); emitFailed(QString("Unable to create index for mod %1!").arg(m_mod.name));
} }
#ifdef Q_OS_WIN32
SetFileAttributesA(index_dir.path().toStdString().c_str(), FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
#endif
} }
void LocalModUpdateTask::executeTask() void LocalModUpdateTask::executeTask()