maj du currentdir

This commit is contained in:
bruno 2023-06-30 14:17:21 -04:00
parent 97466a8f71
commit 7d4d6cb0e7
6 changed files with 27 additions and 7 deletions

View File

@ -10,14 +10,19 @@ vars:
GORUN: "{{.GOCMD}} run" GORUN: "{{.GOCMD}} run"
GOTEST: "{{.GOCMD}} test -v" GOTEST: "{{.GOCMD}} test -v"
GOCOVER: "{{.GOCMD}} test -v --cover" GOCOVER: "{{.GOCMD}} test -v --cover"
# Variables to get version
VERSION: VERSION:
sh: cd version/ && versionManager go version sh: cd version/ && versionManager go version
## Binary name ##
WINDOWS_BINARY_NAME: ./release/windows/{{.VERSION}}/kode-starter.exe WINDOWS_BINARY_NAME: ./release/windows/{{.VERSION}}/kode-starter.exe
LINUX_BINARY_NAME: ./release/linux/{{.VERSION}}/kode-starter LINUX_BINARY_NAME: ./release/linux/{{.VERSION}}/kode-starter
# env: # faire un build pour Windows sur linux il faut installer mingw-w64
GOOS: Linux # sudo apt-get install mingw-w64
env:
GOOS: windows
GOARCH: amd64 GOARCH: amd64
tasks: tasks:
@ -26,7 +31,7 @@ tasks:
linux-version: linux-version:
cmds: cmds:
- "cd ./version/ && versionManager go build" - "cd ./version/ && versionManager go build"
silent: true # silent: true
## Build ## ## Build ##
linux-build: linux-build:
@ -46,12 +51,12 @@ tasks:
windows-version: windows-version:
cmds: cmds:
- "cd ./version/ && versionManager.exe go build" - "cd ./version/ && versionManager.exe go build"
silent: true # silent: true
windows-build: windows-build:
cmds: cmds:
- "{{.GOBUILD}} {{.WINDOWS_BINARY_NAME}} -v" - "{{.GOBUILD}} {{.WINDOWS_BINARY_NAME}} -v"
silent: true # silent: true
## change Build version and build ## change Build version and build
windows-vbuild: windows-vbuild:

View File

@ -440,7 +440,7 @@ func (c *Config) Init() {
c.SetModifDate(modifDate) c.SetModifDate(modifDate)
// set config file name // set config file name
var configFileYmlName string = "config.yml" var configFileYmlName string = utils.GetProgramDir() + "/config.yml"
c.SetConfigFileYmlName(configFileYmlName) c.SetConfigFileYmlName(configFileYmlName)
// set token from environment variable // set token from environment variable

Binary file not shown.

Binary file not shown.

View File

@ -151,3 +151,18 @@ func ColorizeSubStrRed(s string, sub string) string {
func DoubleBackSlash(s string) string { func DoubleBackSlash(s string) string {
return strings.Replace(s, "\\", "\\\\", -1) return strings.Replace(s, "\\", "\\\\", -1)
} }
// function that return the program current directory
func GetProgramDir() string {
// get the absolut path of the executable
ex, err := os.Executable()
if err != nil {
panic(err)
}
// get the directory of the executable
exPath := filepath.Dir(ex)
return exPath
}

View File

@ -15,7 +15,7 @@ type Version struct {
// version variable that will be set at build time by versionManager.exe // version variable that will be set at build time by versionManager.exe
// *** DO NOT EDIT *** // *** DO NOT EDIT ***
var versionNumber Version = Version{0, 0, 0, 26} var versionNumber Version = Version{0, 0, 0, 28}
// GetFullVersion returns the full version number as a string // GetFullVersion returns the full version number as a string
func GetFullVersion() string { func GetFullVersion() string {