diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-03 18:12:38 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-03 18:12:38 -0500 |
commit | aff7b69cab2ac1d09b47f28c6fa653febd8595ea (patch) | |
tree | 61b51949d83ca4a8ccd9074e3424b4f13089a6fa | |
parent | 0e6b7378a564bb51b3a4289059e80fe9e3c6545b (diff) | |
download | planr-aff7b69cab2ac1d09b47f28c6fa653febd8595ea.tar.xz planr-aff7b69cab2ac1d09b47f28c6fa653febd8595ea.zip |
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 } |