resolveRelPath returns the task file path relative to the scan directory.
(scanDir, filePath string)
| 121 | |
| 122 | // resolveRelPath returns the task file path relative to the scan directory. |
| 123 | func resolveRelPath(scanDir, filePath string) string { |
| 124 | absScanDir, err := filepath.Abs(scanDir) |
| 125 | if err != nil { |
| 126 | return filePath |
| 127 | } |
| 128 | relPath, err := filepath.Rel(absScanDir, filePath) |
| 129 | if err != nil { |
| 130 | return filePath |
| 131 | } |
| 132 | return relPath |
| 133 | } |
| 134 | |
| 135 | // cleanupWorklog removes the worklog file and its parent directory if empty. |
| 136 | func cleanupWorklog(taskFilePath, taskID string) { |