| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 46876d5 commit 74f4435
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -456,7 +456,9 @@ Module._extensions['.json'] = function(module, filename) { | |||
| 456 | 456 | ||
| 457 | 457 | ||
| 458 | 458 | //Native extension for .node | |
| 459 | - Module._extensions['.node'] = process.dlopen; | ||
| 459 | + Module._extensions['.node'] = function(module, filename) { | ||
| 460 | + return process.dlopen(module, path._makeLong(filename)); | ||
| 461 | + }; | ||
| 460 | 462 | ||
| 461 | 463 | ||
| 462 | 464 | // bootstrap main module. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,13 @@ | |||
| 1 | + #include <node.h> | ||
| 2 | + #include <v8.h> | ||
| 3 | + | ||
| 4 | + void Method(const v8::FunctionCallbackInfo<v8::Value>& args) { | ||
| 5 | + v8::Isolate* isolate = args.GetIsolate(); | ||
| 6 | + args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); | ||
| 7 | + } | ||
| 8 | + | ||
| 9 | + void init(v8::Local<v8::Object> target) { | ||
| 10 | + NODE_SET_METHOD(target, "hello", Method); | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + NODE_MODULE(binding, init); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,8 @@ | |||
| 1 | + { | ||
| 2 | + 'targets': [ | ||
| 3 | + { | ||
| 4 | + 'target_name': 'binding', | ||
| 5 | + 'sources': [ 'binding.cc' ] | ||
| 6 | + } | ||
| 7 | + ] | ||
| 8 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,29 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../../common'); | ||
| 3 | + const fs = require('fs'); | ||
| 4 | + const path = require('path'); | ||
| 5 | + const assert = require('assert'); | ||
| 6 | + | ||
| 7 | + common.refreshTmpDir(); | ||
| 8 | + | ||
| 9 | + // make a path that is more than 260 chars long. | ||
| 10 | + // Any given folder cannot have a name longer than 260 characters, | ||
| 11 | + // so create 10 nested folders each with 30 character long names. | ||
| 12 | + var addonDestinationDir = path.resolve(common.tmpDir); | ||
| 13 | + | ||
| 14 | + for (var i = 0; i < 10; i++) { | ||
| 15 | + addonDestinationDir = path.join(addonDestinationDir, 'x'.repeat(30)); | ||
| 16 | + fs.mkdirSync(addonDestinationDir); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + const addonPath = path.join(__dirname, 'build', 'Release', 'binding.node'); | ||
| 20 | + const addonDestinationPath = path.join(addonDestinationDir, 'binding.node'); | ||
| 21 | + | ||
| 22 | + // Copy binary to long path destination | ||
| 23 | + var contents = fs.readFileSync(addonPath); | ||
| 24 | + fs.writeFileSync(addonDestinationPath, contents); | ||
| 25 | + | ||
| 26 | + // Attempt to load at long path destination | ||
| 27 | + var addon = require(addonDestinationPath); | ||
| 28 | + assert(addon != null); | ||
| 29 | + assert(addon.hello() == 'world'); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments