blob: c72eb6ecf0a3015986da3d641c82c1b3b3f2c706 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
var path = require('path'),
isAbsolute = function (p) {
if (path.isAbsolute) {
return path.isAbsolute(p);
}
return path.resolve(p) === path.normalize(p);
};
exports.isAbsolute = isAbsolute;
exports.asAbsolute = function (file, baseDir) {
return isAbsolute(file) ? file : path.resolve(baseDir || process.cwd, file);
};
exports.relativeTo = function (file, origFile) {
return isAbsolute(file) ? file : path.resolve(path.dirname(origFile), file);
};
|