Let potomo detect a Cygwin gettext install

This is useful on AppVeyor, which has Cygwin with the gettext-devel
package installed by default.
This commit is contained in:
Oliver Hamlet
2016-07-21 19:50:07 +01:00
parent 23d1522f8b
commit a3daf85deb
+18 -2
View File
@@ -3,9 +3,25 @@
const childProcess = require('child_process');
const fs = require('fs');
const path = require('path');
const helpers = require('./helpers');
/* This isn't portable but it doesn't (yet?) need to be. */
const msgfmtPath = path.join('C:\\', 'Program Files (x86)', 'Poedit', 'GettextTools', 'bin', 'msgfmt.exe');
function getMsgfmtPath() {
const paths = [
path.join('C:\\', 'Program Files (x86)', 'Poedit', 'GettextTools', 'bin', 'msgfmt.exe'),
path.join('C:\\', 'cygwin', 'bin', 'msgfmt.exe'),
];
for (let i = 0; i < paths.length; ++i) {
if (helpers.fileExists(paths[i])) {
return paths[i];
}
}
throw new Error('No msgfmt.exe found!');
}
/* This isn't portable to Linux but it doesn't (yet?) need to be. */
const msgfmtPath = getMsgfmtPath();
let rootPath = '.';
if (process.argv.length > 2) {