SDA-3416 Logs location alignment

This commit is contained in:
sbenmoussati 2021-10-22 15:45:36 +02:00
parent e7f4470d9c
commit b8b6f3a962

View File

@ -108,19 +108,14 @@ export const collectLogs = (): void => {
*/ */
export const packageLogs = (retrievedLogs: ILogs[]): void => { export const packageLogs = (retrievedLogs: ILogs[]): void => {
const FILE_EXTENSIONS = ['.log']; const FILE_EXTENSIONS = ['.log'];
const MAC_LOGS_PATH = '/Library/Logs/Symphony/'; const logsPath = app.getPath('logs');
const LINUX_LOGS_PATH = '/.config/Symphony/';
const WINDOWS_LOGS_PATH = '\\AppData\\Local\\Symphony\\Symphony\\logs';
const logsPath = isMac
? MAC_LOGS_PATH
: isLinux
? LINUX_LOGS_PATH
: WINDOWS_LOGS_PATH;
const source = app.getPath('home') + logsPath;
const focusedWindow = BrowserWindow.getFocusedWindow(); const focusedWindow = BrowserWindow.getFocusedWindow();
if (!fs.existsSync(source) && focusedWindow && !focusedWindow.isDestroyed()) { if (
!fs.existsSync(logsPath) &&
focusedWindow &&
!focusedWindow.isDestroyed()
) {
logger.error(`reports-handler: Can't find any logs to share!`); logger.error(`reports-handler: Can't find any logs to share!`);
dialog.showMessageBox(focusedWindow, { dialog.showMessageBox(focusedWindow, {
message: i18n.t(`Can't find any logs to share!`)(), message: i18n.t(`Can't find any logs to share!`)(),
@ -134,7 +129,7 @@ export const packageLogs = (retrievedLogs: ILogs[]): void => {
const destination = app.getPath('downloads') + destPath + timestamp + '.zip'; const destination = app.getPath('downloads') + destPath + timestamp + '.zip';
generateArchiveForDirectory( generateArchiveForDirectory(
source, logsPath,
destination, destination,
FILE_EXTENSIONS, FILE_EXTENSIONS,
retrievedLogs, retrievedLogs,