mirror of
https://github.com/akiyosi/goneovim.git
synced 2025-08-29 14:18:15 +02:00
Fix to set the application CWD to the HOME directory (#122)
This commit is contained in:
parent
2c24538941
commit
2307784a46
3 changed files with 30 additions and 13 deletions
|
@ -2,6 +2,8 @@ package util
|
|||
|
||||
import (
|
||||
"strings"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/therecipe/qt/core"
|
||||
"github.com/therecipe/qt/gui"
|
||||
|
@ -268,3 +270,15 @@ func NewVFlowLayout(spacing int, padding int, paddingTop int, rightIdex int, wid
|
|||
})
|
||||
return layout
|
||||
}
|
||||
|
||||
func ExpandTildeToHomeDirectory(path string) (string, error) {
|
||||
if len(path) == 0 || path[0] != '~' {
|
||||
return path, nil
|
||||
}
|
||||
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(usr.HomeDir, path[1:]), nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue