|
12345678910111213141516171819202122232425262728 |
- "use strict";
-
- var path = require("path");
-
- module.exports = function (thePath, potentialParent) {
-
- thePath = stripTrailingSep(thePath);
- potentialParent = stripTrailingSep(potentialParent);
-
-
- if (process.platform === "win32") {
- thePath = thePath.toLowerCase();
- potentialParent = potentialParent.toLowerCase();
- }
-
- return thePath.lastIndexOf(potentialParent, 0) === 0 &&
- (
- thePath[potentialParent.length] === path.sep ||
- thePath[potentialParent.length] === undefined
- );
- };
-
- function stripTrailingSep(thePath) {
- if (thePath[thePath.length - 1] === path.sep) {
- return thePath.slice(0, -1);
- }
- return thePath;
- }
|