mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-20 22:31:00 +00:00
Expand ~ in file opening
This commit is contained in:
parent
bbda5d59d0
commit
acabfcb8bb
1 changed files with 3 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"github.com/atotto/clipboard"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"io/ioutil"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -280,6 +281,8 @@ func (v *View) OpenFile() {
|
|||
if canceled {
|
||||
return
|
||||
}
|
||||
home, _ := homedir.Dir()
|
||||
filename = strings.Replace(filename, "~", home, 1)
|
||||
file, err := ioutil.ReadFile(filename)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue