-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: allow long paths for require on Windows
#1801 introduced internal fs methods to speed up require. The methods do not call path._makeLong like their counterpart from the fs module. This brings back the old behaviour. Fixes: #1990 Fixes: #1980 Fixes: #1849
- Loading branch information
Showing
2 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
var common = require('../common'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var assert = require('assert'); | ||
|
||
// make a path that will be at least 260 chars long. | ||
var fileNameLen = Math.max(260 - common.tmpDir.length - 1, 1); | ||
var fileName = path.join(common.tmpDir, new Array(fileNameLen + 1).join('x')); | ||
var fullPath = path.resolve(fileName); | ||
|
||
common.refreshTmpDir(); | ||
fs.writeFileSync(fullPath, 'module.exports = 42;'); | ||
|
||
assert.equal(require(fullPath), 42); | ||
|
||
fs.unlinkSync(fullPath); |