Tennessee Gibbs 0304752480 added pages to master | 6 years ago | |
---|---|---|
.. | ||
node_modules/glob | 6 years ago | |
.npmignore | 6 years ago | |
LICENSE | 6 years ago | |
README.md | 6 years ago | |
index.js | 6 years ago | |
package.json | 6 years ago |
trueCasePathSync(<fileSystemPath>)
Given a possibly case-variant version of an existing filesystem path, returns the case-exact, normalized version as stored in the filesystem.
If the input path is a globbing pattern as defined by the 'glob' npm package, only the 1st match, if any, is returned. Only a literal input path guarantees an unambiguous result.
If no matching path exists, undefined is returned. On case-SENSITIVE filesystems, a match will also be found, but if case variations of a given path exist, it is undefined which match is returned.
Windows, OSX, and Linux (though note the limitations with case-insensitive filesystems).
'./'
are acceptable, but paths starting with '../'
are not - when in doubt, resolve with fs.realPathSync()
first.
An initial '.'
and interior '..'
instances are normalized, but a relative
input path still results in a relative output path. If you want to ensure
an absolute output path, apply fs.realPathSync()
to the result.const trueCasePathSync = require('true-case-path')
trueCasePathSync('/users/guest') // OSX: -> '/Users/Guest'
trueCasePathSync('c:\\users\\all users') // Windows: -> 'c:\Users\All Users'
The code for this project was sourced from http://stackoverflow.com/a/33139702/45375