Browse Source

Check for the compiled bindings in both places.

When node switched it's build system to GYP then the resulting bin
will be put in "Release" instead of "build". So check for both places with a
little `bindings.js` shim.
v1.x
Nathan Rajlich 13 years ago
parent
commit
42fce70a89
  1. 10
      lib/bindings.js
  2. 2
      lib/canvas.js
  3. 2
      lib/context2d.js
  4. 2
      lib/image.js
  5. 2
      lib/pixelarray.js

10
lib/bindings.js

@ -0,0 +1,10 @@
/**
* Compat for changes from node 0.4.x to 0.6.x.
*/
try {
module.exports = require('../build/Release/canvas');
} catch (e) { try {
module.exports = require('../build/default/canvas');
} catch (e) {
throw e;
}}

2
lib/canvas.js

@ -9,7 +9,7 @@
* Module dependencies.
*/
var canvas = require('../build/default/canvas')
var canvas = require('./bindings')
, Canvas = canvas.Canvas
, Image = canvas.Image
, cairoVersion = canvas.cairoVersion

2
lib/context2d.js

@ -9,7 +9,7 @@
* Module dependencies.
*/
var canvas = require('../build/default/canvas')
var canvas = require('./bindings')
, Context2d = canvas.CanvasRenderingContext2d
, CanvasGradient = canvas.CanvasGradient
, ImageData = canvas.ImageData

2
lib/image.js

@ -9,7 +9,7 @@
* Module dependencies.
*/
var Canvas = require('../build/default/canvas')
var Canvas = require('./bindings')
, Image = Canvas.Image;
/**

2
lib/pixelarray.js

@ -9,7 +9,7 @@
* Module dependencies.
*/
var Canvas = require('../build/default/canvas')
var Canvas = require('./bindings')
, PixelArray = Canvas.CanvasPixelArray;
/**

Loading…
Cancel
Save