diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-20 21:37:22 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-05-20 21:37:22 +0200 |
commit | 5bfc9f2f5604740fdbc24f4fbecc17834d430eda (patch) | |
tree | 7843eabf0d36316d537d758be026087873bdf496 | |
parent | 86a65e528716ba68a395156c36d2ec560a42d7c1 (diff) | |
download | gitbook-5bfc9f2f5604740fdbc24f4fbecc17834d430eda.zip gitbook-5bfc9f2f5604740fdbc24f4fbecc17834d430eda.tar.gz gitbook-5bfc9f2f5604740fdbc24f4fbecc17834d430eda.tar.bz2 |
Fix PathUtils.isInRoot on windows
-rw-r--r-- | lib/utils/path.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/utils/path.js b/lib/utils/path.js index 9daa8e6..f65d1b2 100644 --- a/lib/utils/path.js +++ b/lib/utils/path.js @@ -8,7 +8,13 @@ function normalizePath(filename) { // Return true if file path is inside a folder function isInRoot(root, filename) { + root = path.normalize(root); filename = path.normalize(filename); + + if (root[root.length - 1] != path.sep) { + root = root + path.sep; + } + return (filename.substr(0, root.length) === root); } |