Merge pull request #7093 from Snuffleupagus/gulp-importl10n-dir-fix

Use the correct path when checking if a `/l10n` directory exists, to avoid errors during `gulp importl10n` (PR 7063 followup)
This commit is contained in:
Tim van der Meij 2016-03-20 22:12:30 +01:00
commit 7ad8f3a6f0

View File

@ -55,13 +55,14 @@ function downloadLanguageFiles(root, langCode, callback) {
var files = ['chrome.properties', 'viewer.properties']; var files = ['chrome.properties', 'viewer.properties'];
var downloadsLeft = files.length; var downloadsLeft = files.length;
if (!fs.existsSync(langCode)) { var outputDir = path.join(root, langCode);
fs.mkdirSync(path.join(root, langCode)); if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir);
} }
// Download the necessary files for this language. // Download the necessary files for this language.
files.forEach(function(fileName) { files.forEach(function(fileName) {
var outputPath = path.join(root, langCode, fileName); var outputPath = path.join(outputDir, fileName);
var url = MOZCENTRAL_ROOT + langCode + MOZCENTRAL_PDFJS_DIR + var url = MOZCENTRAL_ROOT + langCode + MOZCENTRAL_PDFJS_DIR +
fileName + MOZCENTRAL_RAW_FLAG; fileName + MOZCENTRAL_RAW_FLAG;
var request = http.get(url, function(response) { var request = http.get(url, function(response) {