Skip to content

Commit

Permalink
Move debug archive for vfs creation out of log entry creation
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra authored and mgallien committed Nov 22, 2024
1 parent 580420c commit 9850434
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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());
Expand Down

0 comments on commit 9850434

Please sign in to comment.