fix: treat data directory the same in logs as elsewhere
Vincent Ambo
created
logs.go was the only place that explicitly joined
`Options.DataDirectory` with the working directory, everywhere else uses
it as-is.
Changing this means that we can consistently have a `DataDirectory` that
is either a relative or an absolute path and have things work just fine.
@@ -45,7 +45,7 @@ var logsCmd = &cobra.Command{
if err != nil {
return fmt.Errorf("failed to load configuration: %v", err)
}
- logsFile := filepath.Join(cfg.WorkingDir(), cfg.Options.DataDirectory, "logs", "crush.log")
+ logsFile := filepath.Join(cfg.Options.DataDirectory, "logs", "crush.log")
_, err = os.Stat(logsFile)
if os.IsNotExist(err) {
log.Warn("Looks like you are not in a crush project. No logs found.")