fix: get file path, fixed jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070

This commit is contained in:
qingwei.li 2017-06-23 16:52:37 +08:00
commit e8117e515d
No known key found for this signature in database
GPG key ID: B6DDC2F7AE80B2F4
4 changed files with 8 additions and 5 deletions

View file

@ -22,7 +22,7 @@ export class History {
return this.config.basePath
}
getFile (path) {
getFile (path, isRelative) {
path = path || this.getCurrentPath()
const { config } = this
@ -33,6 +33,10 @@ export class History {
path = path === '/README.md' ? (config.homepage || path) : path
path = isAbsolutePath(path) ? path : getPath(base, path)
if (isRelative) {
path = path.replace(new RegExp(`^${base}`), '')
}
return path
}

View file

@ -71,7 +71,7 @@ export class HashHistory extends History {
return {
path,
file: this.getFile(path),
file: this.getFile(path, true),
query: parseQuery(query)
}
}