Move debug archive for vfs creation out of log entry creation
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 6 Nov 2024 17:07:28 +0000 (02:07 +0900)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 22 Nov 2024 09:08:32 +0000 (10:08 +0100)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/generalsettings.cpp

index e2822024ff874b852b4634e7e770239ff8848fd1..f589fb3c59eaf6f71f40b198f096cd6d618a98bf 100644 (file)
@@ -118,23 +118,6 @@ QVector<ZipEntry> createDebugArchiveFileList()
                       std::copy(std::cbegin(newEntries), std::cend(newEntries), std::back_inserter(list));
                   });
 
-#ifdef BUILD_FILE_PROVIDER_MODULE
-
-    const auto fileProvider = OCC::Mac::FileProvider::instance();
-    if (fileProvider && fileProvider->fileProviderAvailable()) {
-        const auto tempDir = QTemporaryDir();
-        const auto xpc = fileProvider->xpc();
-        const auto vfsAccounts = OCC::Mac::FileProviderSettingsController::instance()->vfsEnabledAccounts();
-        for (const auto &accountUserIdAtHost : vfsAccounts) {
-            const auto vfsLogFilename = QStringLiteral("macOS_vfs_%1.log").arg(accountUserIdAtHost);
-            const auto vfsLogPath = tempDir.filePath(vfsLogFilename);
-            xpc->createDebugArchiveForExtension(accountUserIdAtHost, vfsLogPath);
-            list.append(fileInfoToZipEntry(QFileInfo(vfsLogPath)));
-        }
-    }
-
-#endif
-
     return list;
 }
 
@@ -160,6 +143,21 @@ bool createDebugArchive(const QString &filename)
         zip.addLocalFile(entry.localFilename, entry.zipFilename);
     }
 
+#ifdef BUILD_FILE_PROVIDER_MODULE
+    const auto fileProvider = OCC::Mac::FileProvider::instance();
+    if (fileProvider && fileProvider->fileProviderAvailable()) {
+        const auto tempDir = QTemporaryDir();
+        const auto xpc = fileProvider->xpc();
+        const auto vfsAccounts = OCC::Mac::FileProviderSettingsController::instance()->vfsEnabledAccounts();
+        for (const auto &accountUserIdAtHost : vfsAccounts) {
+            const auto vfsLogFilename = QStringLiteral("macOS_vfs_%1.log").arg(accountUserIdAtHost);
+            const auto vfsLogPath = tempDir.filePath(vfsLogFilename);
+            xpc->createDebugArchiveForExtension(accountUserIdAtHost, vfsLogPath);
+            zip.addLocalFile(vfsLogPath, vfsLogFilename);
+        }
+    }
+#endif
+
     const auto clientParameters = QCoreApplication::arguments().join(' ').toUtf8();
     zip.prepareWriting("__nextcloud_client_parameters.txt", {}, {}, clientParameters.size());
     zip.writeData(clientParameters, clientParameters.size());