aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-05 20:17:00 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-05 20:17:00 -0500
commitfd66fb134967067ed7e1c3182325f646b73c730b (patch)
tree4805195560b9e552c9f41bb57f7ee33674783778
parent91666d1f2e766bc7c3073ed4cd731637c6885e36 (diff)
downloadplanr-0.1.0.tar.xz
planr-0.1.0.zip
Fix bug where standard dirs are not set due to abs positioningv0.1.0
-rw-r--r--cmd/planr/main.go2
-rw-r--r--stddirs.go10
2 files changed, 6 insertions, 6 deletions
diff --git a/cmd/planr/main.go b/cmd/planr/main.go
index 93f1cbf..2243203 100644
--- a/cmd/planr/main.go
+++ b/cmd/planr/main.go
@@ -76,7 +76,7 @@ func main() {
log.SetFlags(log.Llongfile | log.Lmsgprefix)
log.SetPrefix("planr: ")
- if len(os.Args) < 2 {
+ if flag.NArg() < 1 {
dieUsage()
}
diff --git a/stddirs.go b/stddirs.go
index 1eae439..581af87 100644
--- a/stddirs.go
+++ b/stddirs.go
@@ -68,17 +68,17 @@ func dirFromEnv(name, env string) *string {
func (c *DirConfig) SetSrc(srcDir string) {
dieDirAbsent("src", srcDir)
- c.src = srcDir
+ c.src = abs(srcDir)
}
func (c *DirConfig) SetConfig(configDir string) {
dieDirAbsent("planr (config)", configDir)
- c.config = configDir
+ c.config = abs(configDir)
}
func (c *DirConfig) SetBuild(buildDir string) {
dieDirAbsent("build", buildDir)
- c.build = buildDir
+ c.build = abs(buildDir)
}
func (c *DirConfig) SetConfigFromTree(cdir string) {
@@ -147,8 +147,8 @@ func abs(path string) string {
}
func (c DirConfig) Build() string {
- if c.src != "" {
- return c.src
+ if c.build != "" {
+ return c.build
}
if dir := dirFromEnv("build", ENV_BUILD_DIR); dir != nil {