mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
feat: warnings when instance resources are linked
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
9f441a9678
commit
a1053a4c5a
13 changed files with 179 additions and 3 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#include "Resource.h"
|
||||
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "FileSystem.h"
|
||||
|
||||
|
|
@ -152,3 +154,21 @@ bool Resource::destroy()
|
|||
|
||||
return FS::deletePath(m_file_info.filePath());
|
||||
}
|
||||
|
||||
bool Resource::isSymLinkUnder(const QString& instPath) const
|
||||
{
|
||||
if (isSymLink())
|
||||
return true;
|
||||
|
||||
auto instDir = QDir(instPath);
|
||||
|
||||
auto relAbsPath = instDir.relativeFilePath(m_file_info.absoluteFilePath());
|
||||
auto relCanonPath = instDir.relativeFilePath(m_file_info.canonicalFilePath());
|
||||
|
||||
return relAbsPath != relCanonPath;
|
||||
}
|
||||
|
||||
bool Resource::isMoreThanOneHardLink() const
|
||||
{
|
||||
return FS::hardLinkCount(m_file_info.absoluteFilePath()) > 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue