2015-09-20 00:03:32 +02:00
|
|
|
'use strict';
|
|
|
|
const common = require('../../common');
|
2017-07-01 01:29:09 +02:00
|
|
|
if (common.isWOW64)
|
|
|
|
common.skip('doesn\'t work on WOW64');
|
|
|
|
|
2015-09-20 00:03:32 +02:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
common.refreshTmpDir();
|
|
|
|
|
|
|
|
// make a path that is more than 260 chars long.
|
|
|
|
// Any given folder cannot have a name longer than 260 characters,
|
|
|
|
// so create 10 nested folders each with 30 character long names.
|
2017-01-08 14:19:00 +01:00
|
|
|
let addonDestinationDir = path.resolve(common.tmpDir);
|
2015-09-20 00:03:32 +02:00
|
|
|
|
2017-01-08 14:19:00 +01:00
|
|
|
for (let i = 0; i < 10; i++) {
|
2015-09-20 00:03:32 +02:00
|
|
|
addonDestinationDir = path.join(addonDestinationDir, 'x'.repeat(30));
|
|
|
|
fs.mkdirSync(addonDestinationDir);
|
|
|
|
}
|
|
|
|
|
2016-09-28 20:14:23 +02:00
|
|
|
const addonPath = path.join(__dirname,
|
|
|
|
'build',
|
|
|
|
common.buildType,
|
|
|
|
'binding.node');
|
2015-09-20 00:03:32 +02:00
|
|
|
const addonDestinationPath = path.join(addonDestinationDir, 'binding.node');
|
|
|
|
|
|
|
|
// Copy binary to long path destination
|
2017-01-08 14:19:00 +01:00
|
|
|
const contents = fs.readFileSync(addonPath);
|
2015-09-20 00:03:32 +02:00
|
|
|
fs.writeFileSync(addonDestinationPath, contents);
|
|
|
|
|
|
|
|
// Attempt to load at long path destination
|
2016-12-31 00:38:06 +01:00
|
|
|
const addon = require(addonDestinationPath);
|
2016-12-30 16:09:13 +01:00
|
|
|
assert.notStrictEqual(addon, null);
|
2016-11-29 19:33:28 +01:00
|
|
|
assert.strictEqual(addon.hello(), 'world');
|