g3n / g3nd

G3N Game Engine Demo
BSD 2-Clause "Simplified" License
281 stars 31 forks source link

Should g3nd auto-detect where it's data directory lives? #10

Closed justinclift closed 6 years ago

justinclift commented 6 years ago

Compiled g3nd following the instructions, then attempted to run it (from my home dir). Failure, as it doesn't seem to know how to look for it's data directory:

$ g3nd 
16:00:55.296763:I:G3ND:G3N Demo v0.5 starting
16:00:55.296894:F:G3ND:Data directory NOT FOUND
panic: LOG FATAL

goroutine 1 [running, locked to thread]:
github.com/g3n/engine/util/logger.(*Logger).Log(0xc4200bed90, 0x4, 0x7ccbe7, 0x18, 0x0, 0x0, 0x0)
        /home/jc/go/src/github.com/g3n/engine/util/logger/logger.go:253 +0x103b
github.com/g3n/engine/util/logger.(*Logger).Fatal(0xc4200bed90, 0x7ccbe7, 0x18, 0x0, 0x0, 0x0)
        /home/jc/go/src/github.com/g3n/engine/util/logger/logger.go:194 +0x66
github.com/g3n/g3nd/g3nd.(*App).checkDirData(0xc4200d4800, 0x7c373f, 0x4, 0xc4200f1eb8, 0x3)
        /home/jc/go/src/github.com/g3n/g3nd/g3nd/g3nd.go:553 +0x236
github.com/g3n/g3nd/g3nd.Create(0xc420084870, 0xc4200f1f70)
        /home/jc/go/src/github.com/g3n/g3nd/g3nd/g3nd.go:114 +0x21e
main.main()
        /home/jc/go/src/github.com/g3n/g3nd/main.go:23 +0x2d

When launching it from the source directory which go get places it in, things work fine:

$ pwd
/home/jc/go/src/github.com/g3n/g3nd
$ g3nd
16:04:07.637331:I:G3ND:G3N Demo v0.5 starting
16:04:07.637487:I:G3ND:Using data directory:/home/jc/go/src/github.com/g3n/g3nd/data
16:04:07.637516:I:G3ND:OpenGL version: 4.3 (Core Profile) Mesa 17.0.1
16:04:07.681134:I:G3ND:OpenAL Community version: 1.1 ALSOFT 1.16.0
16:04:07.681520:I:G3ND:Xiph.Org libVorbis 1.3.3
...

Is this expected?

leonsal commented 6 years ago

g3nd executable was installed in /home/jc/go/bin ?

justinclift commented 6 years ago

Thanks @leonsal. That was the root cause. I use a split GOPATH with GOBIN set to the second directory. eg:

$ echo $GOPATH
/home/jc/go:/home/jc/git_repos
$ echo $GOBIN
/home/jc/git_repos/bin

Mainly to make things easy for go development. With this approach, things auto-downloaded (eg go get) are placed in $HOME/go, whereas code I'm working on is all in $HOME/git_repos. Makes backing things up easier, and keeps clear separation.

After moving g3nd from $HOME/git_repos/bin to $HOME/go/bin, g3nd finds its data directory automatically. All good. :smile: