| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 828d5d2 commit 3f971d8
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -302,6 +302,10 @@ function preprocessSymlinkDestination(path, type, linkPath) { | |||
| 302 | 302 | path = pathModule.resolve(linkPath, '..', path); | |
| 303 | 303 | return pathModule.toNamespacedPath(path); | |
| 304 | 304 | } | |
| 305 | + if (pathModule.isAbsolute(path)) { | ||
| 306 | + // If the path is absolute, use the \\?\-prefix to enable long filenames | ||
| 307 | + return pathModule.toNamespacedPath(path); | ||
| 308 | + } | ||
| 305 | 309 | // Windows symlinks don't tolerate forward slashes. | |
| 306 | 310 | return ('' + path).replace(/\//g, '\\'); | |
| 307 | 311 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,29 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const path = require('path'); | ||
| 6 | + const fs = require('fs'); | ||
| 7 | + | ||
| 8 | + const tmpdir = require('../common/tmpdir'); | ||
| 9 | + tmpdir.refresh(); | ||
| 10 | + const tmpDir = tmpdir.path; | ||
| 11 | + const longPath = path.join(...[tmpDir].concat(Array(30).fill('1234567890'))); | ||
| 12 | + fs.mkdirSync(longPath, { recursive: true }); | ||
| 13 | + | ||
| 14 | + // Test if we can have symlinks to files and folders with long filenames | ||
| 15 | + const targetDirtectory = path.join(longPath, 'target-directory'); | ||
| 16 | + fs.mkdirSync(targetDirtectory); | ||
| 17 | + const pathDirectory = path.join(tmpDir, 'new-directory'); | ||
| 18 | + fs.symlink(targetDirtectory, pathDirectory, 'dir', common.mustCall((err) => { | ||
| 19 | + assert.ifError(err); | ||
| 20 | + assert(fs.existsSync(pathDirectory)); | ||
| 21 | + })); | ||
| 22 | + | ||
| 23 | + const targetFile = path.join(longPath, 'target-file'); | ||
| 24 | + fs.writeFileSync(targetFile, 'data'); | ||
| 25 | + const pathFile = path.join(tmpDir, 'new-file'); | ||
| 26 | + fs.symlink(targetFile, pathFile, common.mustCall((err) => { | ||
| 27 | + assert.ifError(err); | ||
| 28 | + assert(fs.existsSync(pathFile)); | ||
| 29 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments