aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-02-16 20:01:59 -0800
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-03-20 14:56:32 -0700
commit3ec92acfe7a843a34018fc142439888c4ca5dba0 (patch)
tree6642673efd39e4825930a968a93c758179de4b38
parent656bfd36f607579021a4eaa0893350640b6a3882 (diff)
downloadPrismLauncher-3ec92acfe7a843a34018fc142439888c4ca5dba0.tar.gz
PrismLauncher-3ec92acfe7a843a34018fc142439888c4ca5dba0.tar.bz2
PrismLauncher-3ec92acfe7a843a34018fc142439888c4ca5dba0.zip
fix: use noexcept overload of std::filesystem::hard_link_count
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
-rw-r--r--launcher/FileSystem.cpp8
1 files changed, 7 insertions, 1 deletions
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;
}
}