fix: use noexcept overload of std::filesystem::hard_link_count

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-02-16 20:01:59 -08:00
parent 656bfd36f6
commit 3ec92acfe7

View File

@ -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;
}
}