Skip to content

Commit

Permalink
Windows path fix
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed Jul 5, 2019
1 parent d13be7d commit 24e692c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,19 @@ cointop snapcraft [project page](https://snapcraft.io/cointop).

Note: snaps don't work in Windows WSL. See this [issue thread](https://forum.snapcraft.io/t/windows-subsystem-for-linux/216).

### Windows WSL (Windows)
### Windows

Recommended to install using Go (instructions above).
### PowerShell

Install [Go](https://golang.org/doc/install) and [git](https://git-scm.com/download/win), then:

```powershell
go get -u github.com/miguelmota/cointop
```

### WSL

Recommended to install using Go (instructions [above](#installing)).

You'll need additional font support for Windows WSL. Please see the [wiki](https://github.com/miguelmota/cointop/wiki/Windows-Command-Prompt-and-WSL-Font-Support) for instructions.

Expand Down
8 changes: 5 additions & 3 deletions cointop/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"

Expand Down Expand Up @@ -71,7 +72,7 @@ func (ct *Cointop) createConfigIfNotExists() error {

// NOTE: legacy support for default path
path := ct.configPath()
oldConfigPath := strings.Replace(path, "cointop/config.toml", "cointop/config", 1)
oldConfigPath := NormalizePath(strings.Replace(path, "cointop/config.toml", "cointop/config", 1))
if _, err := os.Stat(oldConfigPath); err == nil {
path = oldConfigPath
ct.configFilepath = oldConfigPath
Expand All @@ -88,8 +89,9 @@ func (ct *Cointop) createConfigIfNotExists() error {

func (ct *Cointop) configDirPath() string {
path := NormalizePath(ct.configFilepath)
parts := strings.Split(path, "/")
return strings.Join(parts[0:len(parts)-1], "/")
separator := string(filepath.Separator)
parts := strings.Split(path, separator)
return strings.Join(parts[0:len(parts)-1], separator)
}

func (ct *Cointop) configPath() string {
Expand Down

0 comments on commit 24e692c

Please sign in to comment.