summaryrefslogtreecommitdiff
path: root/stddirs.go
diff options
context:
space:
mode:
Diffstat (limited to 'stddirs.go')
-rw-r--r--stddirs.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/stddirs.go b/stddirs.go
index e6b510d..1eae439 100644
--- a/stddirs.go
+++ b/stddirs.go
@@ -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
}