summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDelbert <code@delbert.me>2014-11-06 15:50:59 +0800
committerDelbert <code@delbert.me>2014-11-06 15:50:59 +0800
commita741ec13501705e78e2825c593772f1bdb663a43 (patch)
tree4b0e1761e570a069166d42652bc2ce3251989a5c
parent4b26c31b3b2816610ccc5a0eff777153b08ec6ec (diff)
downloadgitbook-a741ec13501705e78e2825c593772f1bdb663a43.zip
gitbook-a741ec13501705e78e2825c593772f1bdb663a43.tar.gz
gitbook-a741ec13501705e78e2825c593772f1bdb663a43.tar.bz2
Bug fix for issue #493: 2-level or more deep relative links may go wrong when in win32
-rw-r--r--lib/generate/site/index.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js
index f0a4780..4d8803e 100644
--- a/lib/generate/site/index.js
+++ b/lib/generate/site/index.js
@@ -154,7 +154,12 @@ Generator.prototype.convertFile = function(content, _input) {
if (_output == "README.html") _output = "index.html";
var output = path.join(this.options.output, _output);
var basePath = path.relative(path.dirname(output), this.options.output) || ".";
-
+
+ // Bug fix for issue #493 which would occur when relative-links are 2-level or more deep in win32
+ if (process.platform === 'win32') {
+ basePath = basePath.replace(/\\/g, '/');
+ }
+
return this.prepareFile(content, _input)
.then(function(page) {
// Index page in search