Slightly fixed path forming for mk using pathx.

This commit is contained in:
Andrey Parhomenko 2023-02-17 13:43:56 +03:00
parent c3eea5be73
commit 58d1a2f98a
5 changed files with 9 additions and 4 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
exe/ exe/
*.swp

View file

@ -12,7 +12,8 @@ install-sh:VQ: build
fi fi
if test -d exe ; then if test -d exe ; then
echo Installing executables... echo Installing executables...
cp -rf exe $EXEDIR/.. mkdir -p $EXEDIR
cp -rf exe/* $EXEDIR/
files=`goblin basename $(ls exe)` files=`goblin basename $(ls exe)`
for i in $files ; do for i in $files ; do
chmod 0755 $EXEDIR/$i chmod 0755 $EXEDIR/$i

View file

@ -9,6 +9,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"sync" "sync"
"github.com/surdeus/goblin/src/pathx"
) )
// True if messages should be printed without fancy colors. // 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.BoolVar(&quiet, "q", false, "don't print recipes before executing them")
flags.Parse(args) flags.Parse(args)
mkfile, err := os.Open(mkfilepath) mkfile, err := os.Open(pathx.From(mkfilepath).Real())
if err != nil { if err != nil {
mkError("no mkfile found") mkError("no mkfile found")
} }

View file

@ -10,6 +10,7 @@ import (
"path/filepath" "path/filepath"
"regexp" "regexp"
"strings" "strings"
"github.com/surdeus/goblin/src/pathx"
) )
type parser struct { type parser struct {
@ -164,7 +165,7 @@ func parseRedirInclude(p *parser, t token) parserStateFun {
for i := range p.tokenbuf { for i := range p.tokenbuf {
filename += expand(p.tokenbuf[i].val, p.rules.vars, true)[0] 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 { if err != nil {
p.basicWarnAtToken(fmt.Sprintf("cannot open %s", filename), p.tokenbuf[0]) p.basicWarnAtToken(fmt.Sprintf("cannot open %s", filename), p.tokenbuf[0])
//p.basicErrorAtToken(fmt.Sprintf("cannot open %s", filename), p.tokenbuf[0]) //p.basicErrorAtToken(fmt.Sprintf("cannot open %s", filename), p.tokenbuf[0])