diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2021-09-03 18:12:38 -0500 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2021-09-03 18:12:38 -0500 |
| commit | d052e22025c386f8071d53252eb49223031f7d65 (patch) | |
| tree | e49be7f124a38fb79f64c3c737da30d09c148eb2 | |
| parent | adccaeb36de036904c735ca5face1c929a4ba0b2 (diff) | |
Ensure stddirs returns an absolute path for correct operation in adapter build directories
| -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 } |
