MCPcopy Index your code
hub / github.com/TruthHun/BookStack / getProjectRoot

Method getProjectRoot

controllers/BookController.go:1228–1236  ·  view source on GitHub ↗

获取书籍的根目录

(fl []filetil.FileList)

Source from the content-addressed store, hash-verified

1226
1227// 获取书籍的根目录
1228func (this *BookController) getProjectRoot(fl []filetil.FileList) (root string) {
1229 var strs []string
1230 for _, f := range fl {
1231 if !f.IsDir {
1232 strs = append(strs, f.Path)
1233 }
1234 }
1235 return utils.LongestCommonPrefix(strs)
1236}
1237
1238// 查找并替换markdown文件中的路径,把图片链接替换成url的相对路径,把文档间的链接替换成【$+文档标识链接】
1239func (this *BookController) fixFileLinks(projectRoot string, identify string) {

Callers 1

unzipToDataMethod · 0.95

Calls 2

LongestCommonPrefixFunction · 0.92
appendFunction · 0.50

Tested by

no test coverage detected