fix: get file path, fixed jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070
This commit is contained in:
parent
25e09dfe07
commit
e8117e515d
4 changed files with 8 additions and 5 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export class HashHistory extends History {
|
|||
|
||||
return {
|
||||
path,
|
||||
file: this.getFile(path),
|
||||
file: this.getFile(path, true),
|
||||
query: parseQuery(query)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue