Resolve CWD arguments as absolute path

Previously when calling e.g 'hs9001 search -cwd .' we would search
for a litteral '.' in the database. Now we resolve that argument
relative to the CWD.
这个提交包含在:
lawl 2021-06-05 14:28:02 +02:00
父节点 70e66f47ba
当前提交 c480519fca
共有 1 个文件被更改,包括 5 次插入1 次删除

查看文件

@ -314,7 +314,11 @@ func main() {
} }
q := strings.Join(args, " ") q := strings.Join(args, " ")
results := search(conn, "%"+q+"%", workDir, beginTimestamp, endTimeStamp, retVal) cwdPath, err := filepath.Abs(workDir)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed parse working directory path: %s\n", err.Error())
}
results := search(conn, "%"+q+"%", cwdPath, beginTimestamp, endTimeStamp, retVal)
previousCmd := "" previousCmd := ""
for e := results.Front(); e != nil; e = e.Next() { for e := results.Front(); e != nil; e = e.Next() {