From 3ec92acfe7a843a34018fc142439888c4ca5dba0 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Thu, 16 Feb 2023 20:01:59 -0800 Subject: [PATCH] fix: use noexcept overload of std::filesystem::hard_link_count Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- launcher/FileSystem.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp index 6ef1eea7..45c73d24 100644 --- a/launcher/FileSystem.cpp +++ b/launcher/FileSystem.cpp @@ -1476,7 +1476,13 @@ bool canLink(const QString& src, const QString& dst) uintmax_t hardLinkCount(const QString& path) { - return fs::hard_link_count(StringUtils::toStdString(path)); + std::error_code err; + int count = fs::hard_link_count(StringUtils::toStdString(path), err); + if (err) { + qWarning() << "Failed to count hard links for" << path << ":" << QString::fromStdString(err.message()); + count = 0; + } + return count; } }