diff options
Diffstat (limited to 'stddirs.go')
-rw-r--r-- | stddirs.go | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -109,7 +109,7 @@ func (c DirConfig) Config() string { } if dir := dirFromEnv("config", ENV_CONFIG_DIR); dir != nil { - c.config = *dir + c.config = abs(*dir) return c.config } @@ -117,7 +117,7 @@ func (c DirConfig) Config() string { log.Fatal("Could not find planr directory"); } - c.config = c.pdFallback; + c.config = abs(c.pdFallback); return c.config } @@ -136,6 +136,16 @@ func (c DirConfig) Src() string { return path.Join(dir, DEFAULT_PATH_SRC) } +func abs(path string) string { + apath, err := filepath.Abs(path) + + if err != nil { + log.Fatalf("Could not find path %s", path) + } + + return apath +} + func (c DirConfig) Build() string { if c.src != "" { return c.src @@ -168,13 +178,13 @@ func (c DirConfig) MkBuild() { } func (c DirConfig) Rubric() string { - rubric := path.Join(c.Config(), "rubric") + rubric := path.Join(c.Config(), DEFAULT_PATH_RUBRIC) dieDirAbsent("rubric", rubric) return rubric } func (c DirConfig) Tests() string { - tests := path.Join(c.Config(), "tests") + tests := path.Join(c.Config(), DEFAULT_PATH_TESTS) dieDirAbsent("tests", tests) return tests } |