1.0.1 • Published 6 years ago
path-cygwin-patch v1.0.1
path-cygwin-patch
A npm module to replace methods of path to handle paths starting with '/' in Cygwin or MSYS2.
Description
The path module of Node.js does not handle paths starting with '/' in Cygwin or MSYS2, so sometimes yields an invalid path and causes a problem.
// On MSYS2
const path = require('path');
console.log(path.join('/c/Users', 'iorate/Documents')); // => \c\Users\iorate\DocumentsThis module exports nothing but patches path in Cygwin or MSYS2.
const path = require('path');
require('path-cygwin-patch');
console.log(path.join('/c/Users', 'iorate/Documents')); // => C:\Users\iorate\DocumentsSome npm executables accept configuration files written in JavaScript. If such an executable has a problem on Cygwin or MSYS2, you can try to inject this module in a configuration file.
// .foorc.js
require('path-cygwin-patch');
module.exports = {
// ...
};Test
npm install
npm testKnown Issue
Patched functions are SLOW because they invoke cygpath internally.
Author
License
path-cygwin-patch is licensed under MIT License.