Last active
August 29, 2015 14:26
-
-
Save buehler/166bdab800e09eb5339a to your computer and use it in GitHub Desktop.
Wrapper for require to prevent fails in absolute pathes for windows. (Because windows does have problems with absolute paths. -> with this global function, all require actions are using "path.join")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global.__require = function () { | |
if (arguments.length <= 0) throw new Error('No arguments provided.'); | |
var join = ''; | |
for (var arg in arguments) { | |
if (arguments.hasOwnProperty(arg)) { | |
join = path.join(join, arguments[arg]); | |
} | |
} | |
return require(join); | |
}; | |
//usage: | |
var file = __require('myNodeFolder', 'subFolder', 'file'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment