Windows path fix

pull/42/head
Miguel Mota 5 years ago
parent d13be7ddda
commit 24e692c65a
No known key found for this signature in database
GPG Key ID: 67EC1161588A00F9

@ -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). 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. 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.

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath"
"strings" "strings"
"time" "time"
@ -71,7 +72,7 @@ func (ct *Cointop) createConfigIfNotExists() error {
// NOTE: legacy support for default path // NOTE: legacy support for default path
path := ct.configPath() 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 { if _, err := os.Stat(oldConfigPath); err == nil {
path = oldConfigPath path = oldConfigPath
ct.configFilepath = oldConfigPath ct.configFilepath = oldConfigPath
@ -88,8 +89,9 @@ func (ct *Cointop) createConfigIfNotExists() error {
func (ct *Cointop) configDirPath() string { func (ct *Cointop) configDirPath() string {
path := NormalizePath(ct.configFilepath) path := NormalizePath(ct.configFilepath)
parts := strings.Split(path, "/") separator := string(filepath.Separator)
return strings.Join(parts[0:len(parts)-1], "/") parts := strings.Split(path, separator)
return strings.Join(parts[0:len(parts)-1], separator)
} }
func (ct *Cointop) configPath() string { func (ct *Cointop) configPath() string {

Loading…
Cancel
Save