Skip to content

Commit

Permalink
Check if file exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Cosifne committed Aug 3, 2023
1 parent 265913d commit 11a6c97
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tasks/localizationTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as path from 'path';
import * as util from 'node:util';
import { EOL } from 'node:os';
import { Octokit } from '@octokit/rest';
import * as fs from 'fs';

type Options = {
userName?: string;
Expand All @@ -27,11 +28,19 @@ function getAllPossibleLocalizationFiles(): string[] {
const files = [];
for (const lang of localizationLanguages) {
for (const file of locFiles) {
files.push('l10n' + path.sep + util.format(file, lang));
const filePath = 'l10n' + path.sep + util.format(file, lang);
files.push(filePath);
}
}

// English
files.push(`l10n${path.sep}bundle.l10n.json`);
files.forEach((file) => {
if (!fs.existsSync(file)) {
throw `${file} doesn't exist!`;
}
});

return files;
}

Expand Down

0 comments on commit 11a6c97

Please sign in to comment.