diff options
author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-05-12 01:13:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 01:13:17 -0700 |
commit | 6b6d6a01dc9cf05715f01e3a549740b169ef9ae3 (patch) | |
tree | 8ba9746a188c39003213839825552543e3f1a48f /launcher/minecraft/World.cpp | |
parent | f27716656c6f6006238203669a7a02f035733fc0 (diff) | |
parent | c5aff7cc1ef43a1326bd3ce0c83e29669e2ff43f (diff) | |
download | PrismLauncher-6b6d6a01dc9cf05715f01e3a549740b169ef9ae3.tar.gz PrismLauncher-6b6d6a01dc9cf05715f01e3a549740b169ef9ae3.tar.bz2 PrismLauncher-6b6d6a01dc9cf05715f01e3a549740b169ef9ae3.zip |
Merge branch 'develop' into fix/network_and_signals
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/minecraft/World.cpp')
-rw-r--r-- | launcher/minecraft/World.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/launcher/minecraft/World.cpp b/launcher/minecraft/World.cpp index d310f8b9..54fb9434 100644 --- a/launcher/minecraft/World.cpp +++ b/launcher/minecraft/World.cpp @@ -56,6 +56,8 @@ #include <optional> +#include "FileSystem.h" + using std::optional; using std::nullopt; @@ -567,3 +569,25 @@ bool World::operator==(const World &other) const { return is_valid == other.is_valid && folderName() == other.folderName(); } + +bool World::isSymLinkUnder(const QString& instPath) const +{ + if (isSymLink()) + return true; + + auto instDir = QDir(instPath); + + auto relAbsPath = instDir.relativeFilePath(m_containerFile.absoluteFilePath()); + auto relCanonPath = instDir.relativeFilePath(m_containerFile.canonicalFilePath()); + + return relAbsPath != relCanonPath; +} + +bool World::isMoreThanOneHardLink() const +{ + if (m_containerFile.isDir()) + { + return FS::hardLinkCount(QDir(m_containerFile.absoluteFilePath()).filePath("level.dat")) > 1; + } + return FS::hardLinkCount(m_containerFile.absoluteFilePath()) > 1; +} |