From c2ed3a562b53cdd2cefccf3d9e6572d4fc7bb6c5 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 26 Jun 2023 01:30:30 +0200 Subject: [PATCH] create .gnupg home dir if it doesn't exist --- src/gpg.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gpg.ts b/src/gpg.ts index b2d1077..7b4145b 100644 --- a/src/gpg.ts +++ b/src/gpg.ts @@ -193,7 +193,11 @@ export const getKeygrip = async (fingerprint: string): Promise => { }; export const configureAgent = async (config: string): Promise => { - const gpgAgentConf = path.join(await getGnupgHome(), 'gpg-agent.conf'); + const gnupgHomeDir = await getGnupgHome(); + if (!fs.existsSync(gnupgHomeDir)) { + fs.mkdirSync(gnupgHomeDir, {recursive: true}); + } + const gpgAgentConf = path.join(gnupgHomeDir, 'gpg-agent.conf'); await fs.writeFile(gpgAgentConf, config, function (err) { if (err) throw err; });