substack/node-browserify — pull request #144 by jdahlq (2012-05-11 19:37:38+00:00)
Title: Windows support - Revision to #137 and #126

This is a revision of issues #137 and #126. I tested it on Windows and Mac OS X. Pull request #137 breaks Browserify for *nix because it replaces some of the *nix regexes with Windows-specific ones (e.g. instead of searching for a forward slash it searches for a backslash).

This new pull request removes most of the changes that seem unnecessary in #137. It changes only two areas of the lib/wrap.js code:

1. For caching, it follows #137 by using process.env.USERPROFILE when process.env.HOME is not available. I verified that this creates a ".config/browserify/cache.json" file in my Windows home directory.
2. Backslashes are replaced by forward slashes in the makeTarget function. This is done at the beginning of the function so that most of the regexes to not need to be changed. Wherever path.normalize() is used, backslashes are again replaced with forward slashes.

Interested parties please test this code, especially because I removed quite a few of the previously proposed modifications in #137. I tested it on a project of moderate complexity.