nikku / node-xsd-schema-validator

A schema (XSD) validator for NodeJS
https://www.npmjs.com/package/xsd-schema-validator
MIT License
51 stars 24 forks source link

javac in Windows #1

Closed mappetz closed 9 years ago

mappetz commented 9 years ago

Hi Nikku, https://github.com/Nikku/node-xsd-schema-validator/blob/master/lib/validator.js#L15 I'm using your module in a Windows environment and this if statement fails in windows because the file is named "javac.exe".

Below the debugging results: cattura1 cattura2 I will let you resolve the issue, otherwise I can do it and require a pull request, let me know.

Just to know, this works for me:

function withValidator(callback) {

  if (!JAVA_HOME) {
    callback(new Error('JAVA_HOME is not defined'));
  } else
  if (!fs.existsSync(JAVA_HOME + '/bin/javac.exe')) {
    callback(new Error('JDK required at JAVA_HOME to compile helper'));
  } else {
    if (fs.existsSync(VALIDATOR + '.class')) {
      callback();
    } else {
      spawn(JAVA_HOME + '/bin/javac.exe', [ 'support/XMLValidator.java' ], { cwd: __dirname + '/../' }).on('exit', callback);
    }
  }
}
nikku commented 9 years ago

Do the test-cases fail for you on windows?

mappetz commented 9 years ago

Yes, grunt test fails using the string javac. Using the previous snippet, with javac.exe grunt test works fine.

senza nome

(My JDK is 1.7.0_40)

nikku commented 9 years ago

Could you checkout v0.1.0 to see if it fixed the issue?

mappetz commented 9 years ago

Perfect, works fine, thank you.