Skip to content

Commit 2203968

Browse files
committed
Ensure output folder for .po files always exists
1 parent b0c2476 commit 2203968

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
4+
## Develop
5+
6+
### Fixed
7+
8+
* Output directory was not being created when saving .po files if it didn't exist.
9+
310
## 1.1.0 — 2025-11-12
411

512
### Fixed

src/utils/poFileUtils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'fs';
2+
import path from 'path';
23
import gettextParser from 'gettext-parser';
34
import { getPoHeaderLocale } from './languageMapping.js';
45

@@ -270,6 +271,11 @@ export async function compilePoFile(parsedPot, targetLang, outputFilePath, logge
270271

271272
try {
272273
const outputContent = gettextParser.po.compile(compiledPoData);
274+
const outputDir = path.dirname(outputFilePath);
275+
276+
if (!fs.existsSync(outputDir)) {
277+
fs.mkdirSync(outputDir, { recursive: true });
278+
}
273279

274280
fs.writeFileSync(outputFilePath, outputContent);
275281

0 commit comments

Comments
 (0)