diff options
author | Kode <TheKodeToad@proton.me> | 2023-05-13 19:07:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-13 19:07:03 +0100 |
commit | f60562c5a247934e39ab33a6d1c5ce64b3127f6a (patch) | |
tree | 3e0ff5817464de7c050c580397503daa9f0ee7bd /launcher/minecraft/World.cpp | |
parent | 18cfe219fef2aabc1d3260764c02cd3476615176 (diff) | |
parent | d5c6a1b4d1e6d052e42366d19ffa0047168e030d (diff) | |
download | PrismLauncher-f60562c5a247934e39ab33a6d1c5ce64b3127f6a.tar.gz PrismLauncher-f60562c5a247934e39ab33a6d1c5ce64b3127f6a.tar.bz2 PrismLauncher-f60562c5a247934e39ab33a6d1c5ce64b3127f6a.zip |
Merge branch 'develop' into mrpack-export
Signed-off-by: Kode <TheKodeToad@proton.me>
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; +} |