From 371cf19a16cdef74a5e9782b3354660cc374df63 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Fri, 25 Mar 2016 14:46:12 -0400 Subject: [PATCH] Use non cgo implementation of homedir --- src/highlighter.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/highlighter.go b/src/highlighter.go index ef91f5c5..964c35c9 100644 --- a/src/highlighter.go +++ b/src/highlighter.go @@ -2,8 +2,8 @@ package main import ( "github.com/gdamore/tcell" + "github.com/mitchellh/go-homedir" "io/ioutil" - "os/user" "path/filepath" "regexp" "strings" @@ -31,8 +31,11 @@ var syntaxFiles map[[2]*regexp.Regexp]FileTypeRules // LoadSyntaxFiles loads the syntax files from the default directory ~/.micro func LoadSyntaxFiles() { - usr, _ := user.Current() - dir := usr.HomeDir + dir, err := homedir.Dir() + if err != nil { + TermMessage("Error finding your home directory\nCan't load runtime files") + return + } LoadSyntaxFilesFromDir(dir + "/.micro/syntax") }