Skip to content

Commit

Permalink
🚀 Fix Windows Version
Browse files Browse the repository at this point in the history
  • Loading branch information
Akecel committed Apr 6, 2023
1 parent 0c6ecad commit 0e71cc1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ the file corresponding to your platform :

Note that for OS security reasons, you may have to download the binary with `curl` to use it :
```bash
❯ curl https://github.com/Akecel/gabbro/releases/download/latest/gabbro-your-plateform
❯ curl -k -L -s https://github.com/Akecel/gabbro/releases/download/latest/gabbro-your-plateform > gabbro
```

Then, rename this file `gabbro` (or `gabbro.exe` for Windows)
Expand Down Expand Up @@ -94,7 +94,7 @@ Create a `bin` directory in your `$HOME` / `%USERPROFILE%/bin` if it does not al

```bash
# CMD
❯ mkdir %USERPROFILE%/bin
❯ mkdir %USERPROFILE%\bin

# Powershell
❯ mkdir $HOME/bin
Expand All @@ -105,9 +105,9 @@ Put the `gabbro.exe` in this `bin` directory then :
- *Windows + R* to open the Run command window
- Run `sysdm.cpl`
- Go to *Advanced* -> *Environment Variables*
- Click on *PATH* then Edit it
- Click on *New* and enter `%USERPROFILE%/bin`
- Valid then logout / logback
- Click on *PATH* (user one) then *Edit* it
- Add `%USERPROFILE%/bin` (separate it from the rest with `;` if needed)
- Valid then Logout / Logback to refresh

### Configuration

Expand Down
14 changes: 11 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ package config

import (
"fmt"
"os"
"runtime"

"github.com/spf13/viper"
)

func InitConfig() {
var binPath string
if runtime.GOOS == "windows" {
binPath = os.Getenv("USERPROFILE") + "/bin"
} else {
binPath = os.Getenv("HOME") + "/bin"
}

// Local config path
viper.AddConfigPath(".")

// Binary config path
viper.AddConfigPath("$GOPATH/bin/")
viper.AddConfigPath("$HOME/bin/")
viper.AddConfigPath("%USERPROFILE%/bin/")
viper.AddConfigPath("$GOPATH/bin")
viper.AddConfigPath(binPath)

// Test config path
viper.AddConfigPath("../")
Expand Down
1 change: 1 addition & 0 deletions tests/gabbro.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Testing config file
client-id: "testing"
access-token: "testing"

0 comments on commit 0e71cc1

Please sign in to comment.