node-sybase
node-sybase copied to clipboard
Unable to find JavaSybaseLink.jar using process.env.PWD
process.env.PWD is domain specific and might not return the correct value everywhere and is also assuming that the main/index.js of an application would be present at the same level as the node_modules folder.
var PATH_TO_JAVA_BRIDGE1 = process.env.PWD + "/node_modules/sybase/JavaSybaseLink/dist/JavaSybaseLink.jar";
When I was trying to run it on windows, the process.env.PWD was returned as undefined.
As you have already put a comment in the src code over that line, //FIXME: this is bad should be a way to expose this jar file in the npm package //so that it can be called properly from parent packages.
I would suggest using the following syntax: var path = require("path"); var PATH_TO_JAVA_BRIDGE1 = path.join(__dirname, "..", "/JavaSybaseLink/dist/JavaSybaseLink.jar");
For me the current path solution caused problems when node-sybase was used in a project, lets call it project A, and then another project needed to use project A. I suggested a similar solution some time ago, but I don't know whether it has any drawbacks.
Yeah sorry must have missed that suggestion a while back. I'll try and fix that soon.
Please fix it, it is a simple path change.
Add this process.env.PWD = __dirname;
before importing the sybase module.
Example:
process.env.PWD = __dirname;
const sybase = require('sybase');