From 58d1a2f98a1666595ff1e227e21f4e4c30f2aece Mon Sep 17 00:00:00 2001 From: surdeus Date: Fri, 17 Feb 2023 13:43:56 +0300 Subject: [PATCH] Slightly fixed path forming for mk using pathx. --- .gitignore | 2 ++ app/mk/inc/std/install | 3 ++- install.sh | 2 +- src/tool/mk/main.go | 3 ++- src/tool/mk/parse.go | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 09c8b20..36b8513 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ exe/ +*.swp + diff --git a/app/mk/inc/std/install b/app/mk/inc/std/install index 82e32cc..598d0bd 100644 --- a/app/mk/inc/std/install +++ b/app/mk/inc/std/install @@ -12,7 +12,8 @@ install-sh:VQ: build fi if test -d exe ; then echo Installing executables... - cp -rf exe $EXEDIR/.. + mkdir -p $EXEDIR + cp -rf exe/* $EXEDIR/ files=`goblin basename $(ls exe)` for i in $files ; do chmod 0755 $EXEDIR/$i diff --git a/install.sh b/install.sh index 08150a8..4887a72 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ wd=`pwd` -cd src/cmd/goblin && go install&& cd $wd +cd src/cmd/goblin && go install && cd $wd mkdir -p $HOME/app/goblin cp -rf app/* $HOME/app/goblin diff --git a/src/tool/mk/main.go b/src/tool/mk/main.go index bbac90e..09d5b49 100644 --- a/src/tool/mk/main.go +++ b/src/tool/mk/main.go @@ -9,6 +9,7 @@ import ( "path/filepath" "strings" "sync" + "github.com/surdeus/goblin/src/pathx" ) // True if messages should be printed without fancy colors. @@ -344,7 +345,7 @@ func Run(args []string) { flags.BoolVar(&quiet, "q", false, "don't print recipes before executing them") flags.Parse(args) - mkfile, err := os.Open(mkfilepath) + mkfile, err := os.Open(pathx.From(mkfilepath).Real()) if err != nil { mkError("no mkfile found") } diff --git a/src/tool/mk/parse.go b/src/tool/mk/parse.go index ef6c2d8..6cdc909 100644 --- a/src/tool/mk/parse.go +++ b/src/tool/mk/parse.go @@ -10,6 +10,7 @@ import ( "path/filepath" "regexp" "strings" + "github.com/surdeus/goblin/src/pathx" ) type parser struct { @@ -164,7 +165,7 @@ func parseRedirInclude(p *parser, t token) parserStateFun { for i := range p.tokenbuf { filename += expand(p.tokenbuf[i].val, p.rules.vars, true)[0] } - file, err := os.Open(filename) + file, err := os.Open(pathx.From(filename).Real()) if err != nil { p.basicWarnAtToken(fmt.Sprintf("cannot open %s", filename), p.tokenbuf[0]) //p.basicErrorAtToken(fmt.Sprintf("cannot open %s", filename), p.tokenbuf[0])