Fix: resolve path in windows

This commit is contained in:
Dreamacro 2018-11-14 20:58:10 +08:00
parent b0e062dc7c
commit 91e35f2f6a

12
main.go
View file

@ -1,17 +1,17 @@
package main package main
import ( import (
"flag"
"os" "os"
"os/signal" "os/signal"
"path/filepath"
"syscall" "syscall"
"flag"
"path"
"github.com/Dreamacro/clash/config" "github.com/Dreamacro/clash/config"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/hub" "github.com/Dreamacro/clash/hub"
"github.com/Dreamacro/clash/proxy" "github.com/Dreamacro/clash/proxy"
"github.com/Dreamacro/clash/tunnel" "github.com/Dreamacro/clash/tunnel"
C "github.com/Dreamacro/clash/constant"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
@ -30,10 +30,10 @@ func main() {
proxy.Instance().Run() proxy.Instance().Run()
hub.Run() hub.Run()
if (homedir != "") { if homedir != "" {
if !path.IsAbs(homedir) { if !filepath.IsAbs(homedir) {
currentDir, _ := os.Getwd() currentDir, _ := os.Getwd()
homedir = path.Join(currentDir, homedir) homedir = filepath.Join(currentDir, homedir)
} }
C.SetHomeDir(homedir) C.SetHomeDir(homedir)
} }