diff --git a/compiler/file_discovery.go b/compiler/file_discovery.go index 474b2ac..bc42582 100644 --- a/compiler/file_discovery.go +++ b/compiler/file_discovery.go @@ -17,6 +17,7 @@ package compiler import ( "os" "path/filepath" + "strings" log "github.com/Sirupsen/logrus" "github.com/jjdekker/ponder/helpers" @@ -60,3 +61,14 @@ func compilePath(root string, opts *settings.Settings, return nil } } + +// outputPath returns the path that the compiled file will take +func outputPath(source string, opts *settings.Settings) string { + file := filepath.Base(source) + dot := strings.LastIndex(file, ".") + if dot == -1 { + log.WithFields(log.Fields{"path": source}).Error("Unable to compute output path") + } + file = file[:dot] + "pdf" + return filepath.Join(opts.OutputDir, file) +}