From 4557a5b9ef15a7fa0ca1e8b5442f03113cf3b1cb Mon Sep 17 00:00:00 2001 From: Mikey Binns <38146638+mikeybinnswebdesign@users.noreply.github.com> Date: Fri, 12 Nov 2021 11:43:40 +0000 Subject: [PATCH] Add windows support for getConnectionInfo This change changes the file path for windows installs. It is tested and works on Windows 11 from within an npm script. I don't have the ability to test if this breaks on MacOS, so be sure to test. --- src/helpers/get-connection-info.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/helpers/get-connection-info.ts b/src/helpers/get-connection-info.ts index 65a739c..38bbd07 100644 --- a/src/helpers/get-connection-info.ts +++ b/src/helpers/get-connection-info.ts @@ -9,7 +9,12 @@ export interface ConnectionInfo { } export default function getConnectionInfo(): ConnectionInfo { - const connectionInfoPath = untildify('~/Library/Application Support/Local/graphql-connection-info.json') + let connectionInfoPath; + if ( process.platform == 'darwin' ) { + connectionInfoPath = untildify('~/Library/Application Support/Local/graphql-connection-info.json'); + } else { + connectionInfoPath = process.env.APPDATA + '\\Local\\graphql-connection-info.json'; + } try { return fs.readJsonSync(connectionInfoPath)