create .gnupg home dir if it doesn't exist

This commit is contained in:
CrazyMax 2023-06-26 01:30:30 +02:00
parent e650e69265
commit c2ed3a562b
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7

View file

@ -193,7 +193,11 @@ export const getKeygrip = async (fingerprint: string): Promise<string> => {
};
export const configureAgent = async (config: string): Promise<void> => {
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;
});