From afc8f86875804a9f6471137ce2ce88ea634a864d Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Mon, 25 Apr 2022 15:43:55 +0200 Subject: [PATCH] MAS: remove default download location (#2070) (#2072) (cherry picked from commit 9b3d37e953230168155a0d305f510ed6da7bcdb7) Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> --- src/common/config/defaultPreferences.ts | 8 +++++--- src/main/app/initialize.ts | 2 +- src/types/config.ts | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/config/defaultPreferences.ts b/src/common/config/defaultPreferences.ts index c6cd2ba1..c8bf6cbb 100644 --- a/src/common/config/defaultPreferences.ts +++ b/src/common/config/defaultPreferences.ts @@ -12,12 +12,14 @@ import os from 'os'; import {ConfigV3} from 'types/config'; -export const getDefaultDownloadLocation = (): string => { +export const getDefaultDownloadLocation = (): string | undefined => { // eslint-disable-next-line no-undef // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - const homePath = __IS_MAC_APP_STORE__ ? path.join(os.homedir(), '../../../../') : os.homedir(); - return path.join(homePath, 'Downloads'); + if (__IS_MAC_APP_STORE__) { + return undefined; + } + return path.join(os.homedir(), 'Downloads'); }; const defaultPreferences: ConfigV3 = { diff --git a/src/main/app/initialize.ts b/src/main/app/initialize.ts index a63cbb21..a4da8eb8 100644 --- a/src/main/app/initialize.ts +++ b/src/main/app/initialize.ts @@ -368,7 +368,7 @@ function initializeAfterAppReady() { } item.setSaveDialogOptions({ title: filename, - defaultPath: path.resolve(Config.downloadLocation, filename), + defaultPath: Config.downloadLocation ? path.resolve(Config.downloadLocation, filename) : undefined, filters, }); diff --git a/src/types/config.ts b/src/types/config.ts index 12c3a11c..d1b3844a 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -37,7 +37,7 @@ export type ConfigV3 = { hideOnStart: boolean; spellCheckerLocales: string[]; darkMode: boolean; - downloadLocation: string; + downloadLocation?: string; spellCheckerURL?: string; lastActiveTeam?: number; startInFullscreen?: boolean; @@ -69,7 +69,7 @@ export type ConfigV2 = { spellCheckerLocale: string; spellCheckerURL?: string; darkMode: boolean; - downloadLocation: string; + downloadLocation?: string; } export type ConfigV1 = {