Hello,
I have one problem:
I would like to get current exe file path. I know I can't rely on os.Getwd() because I want to execute my file from different folders without issues.
So I found
http://andrewbrookins.com/tech/golang-get-directory-of-the-current-file/Sample program:
http://play.golang.org/p/lN0NZn__vH
I changed 1 to 0 in runtime.Caller(0) because runtime.Caller(1) returning c:/Go/src/pkg/runtime/proc.c.
go build and everything looked nice, I got file path but... when I moved my exe file it's still showing me same path it was build in:
D:\Golibs\my\src\hello>hello.exe
D:/Golibs/my/src/hello/hello.go
and different path:
D:\Golibs\my\src>hello.exe
D:/Golibs/my/src/hello/hello.go // still same
Is that expected behaviour?
Is there any cross platform, portable way of getting executable file path? (Not path from with we executing it)
Best regards,
Dobrosław Żybort