Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.
/ path-cygwin-patch Public archive

A npm module to replace methods of 'path' to handle paths starting with '/' in Cygwin or MSYS2.

License

Notifications You must be signed in to change notification settings

iorate/path-cygwin-patch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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\Documents

This 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\Documents

Some 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 test

Known Issue

Patched functions are SLOW because they invoke cygpath internally.

Author

iorate (Twitter)

License

path-cygwin-patch is licensed under MIT License.

About

A npm module to replace methods of 'path' to handle paths starting with '/' in Cygwin or MSYS2.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published