From 59f7c7653798e0e0e39a8931562576c3b036218c Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Tue, 22 Apr 2025 11:14:07 +0200 Subject: [PATCH 1/2] feat: better logs when a file cannot be removed should log the reason why a file cannot be deleted Signed-off-by: Matthieu Gallien --- src/common/filesystembase.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/filesystembase.cpp b/src/common/filesystembase.cpp index b63f6c1a7e156..7ab136b42df31 100644 --- a/src/common/filesystembase.cpp +++ b/src/common/filesystembase.cpp @@ -595,6 +595,7 @@ bool FileSystem::remove(const QString &fileName, QString *errorString) if (errorString) { *errorString = QObject::tr("File is already deleted"); } + qCWarning(lcFileSystem()) << "File is already deleted" << fileName; return false; } } @@ -603,6 +604,7 @@ bool FileSystem::remove(const QString &fileName, QString *errorString) if (errorString) { *errorString = QString::fromLatin1(e.what()); } + qCWarning(lcFileSystem()) << e.what() << fileName; return false; } catch (...) @@ -610,6 +612,7 @@ bool FileSystem::remove(const QString &fileName, QString *errorString) if (errorString) { *errorString = QObject::tr("Error deleting the file"); } + qCWarning(lcFileSystem()) << "Error deleting the file" << fileName; return false; } From db8787dcb28f8868e07ef4858d9e9ed27800dcd5 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Tue, 22 Apr 2025 11:16:21 +0200 Subject: [PATCH 2/2] fix: use safer conversion from QString to filesystem::path Signed-off-by: Matthieu Gallien --- src/common/filesystembase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/filesystembase.cpp b/src/common/filesystembase.cpp index 7ab136b42df31..660e2d382c648 100644 --- a/src/common/filesystembase.cpp +++ b/src/common/filesystembase.cpp @@ -591,7 +591,7 @@ bool FileSystem::remove(const QString &fileName, QString *errorString) #endif try { - if (!std::filesystem::remove(std::filesystem::path{fileName.toUtf8().data()})) { + if (!std::filesystem::remove(std::filesystem::path{fileName.toStdWString()})) { if (errorString) { *errorString = QObject::tr("File is already deleted"); }