From 1f8d527e94ad97e7db14d18406fe0e12983358cb Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 20 Aug 2017 22:44:47 -0700 Subject: [PATCH] path: deprecate internal _makeLong, replace Replace the internal `path._makeLong()` with a public `path.toLongUNCPath()` method. Add documentation. PR-URL: https://github.com/nodejs/node/pull/14956 Ref: https://github.com/standard-things/esm/issues/66 Reviewed-By: Matteo Collina Reviewed-By: Refael Ackermann Reviewed-By: Anna Henningsen --- doc/api/deprecations.md | 10 +++ doc/api/path.md | 16 ++++ lib/fs.js | 88 ++++++++++--------- lib/module.js | 6 +- lib/path.js | 10 ++- test/parallel/test-path-makelong.js | 67 +++++++------- test/sequential/test-async-wrap-getasyncid.js | 2 +- 7 files changed, 116 insertions(+), 83 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 257b5afb65b4e4..e5495fa5ceb587 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -710,6 +710,16 @@ function for [`util.inspect()`][] is deprecated. Use [`util.inspect.custom`][] instead. For backwards compatibility with Node.js prior to version 6.4.0, both may be specified. + +### DEP00XX: path.\_makeLong() + +Type: Documentation-only + +The internal `path._makeLong()` was not intended for public use. However, +userland modules have found it useful. The internal API has been deprecated +and replaced with an identical, public `path.toNamespacedPath()` method. + + [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array [`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer diff --git a/doc/api/path.md b/doc/api/path.md index f2015db47048d7..b072ad8135cd3b 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -543,6 +543,21 @@ On Windows: accepted as path segment separators; however, the `path` methods only add backward slashes (`\`). +## path.toNamespacedPath(path) + + +* `path` {string} +* Returns: {string} + +On Windows systems only, returns an equivalent [namespace-prefixed path][] for +the given `path`. If `path` is not a string, `path` will be returned without +modifications. + +This method is meaningful only on Windows system. On posix systems, the +method is non-operational and always returns `path` without modifications. + ## path.win32