2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Use static QFileInfo::exists

This commit is contained in:
Ilya Fedin
2021-03-13 23:05:36 +04:00
committed by John Preston
parent 9a73c99935
commit 508762cd2c
4 changed files with 8 additions and 8 deletions

View File

@@ -94,7 +94,7 @@ QString filedialogDefaultName(
const auto nameBase = (dir.endsWith('/') ? dir : (dir + '/'))
+ base;
name = nameBase + extension;
for (int i = 0; QFileInfo(name).exists(); ++i) {
for (int i = 0; QFileInfo::exists(name); ++i) {
name = nameBase + qsl(" (%1)").arg(i + 2) + extension;
}
}
@@ -115,7 +115,7 @@ QString filedialogNextFilename(
const auto dir = directory.absolutePath();
const auto nameBase = (dir.endsWith('/') ? dir : (dir + '/')) + prefix;
auto result = nameBase + extension;
for (int i = 0; result.toLower() != cur.toLower() && QFileInfo(result).exists(); ++i) {
for (int i = 0; result.toLower() != cur.toLower() && QFileInfo::exists(result); ++i) {
result = nameBase + qsl(" (%1)").arg(i + 2) + extension;
}
return result;