add realpath over abs_path

This commit is contained in:
cuu 2018-12-12 15:51:25 +08:00
parent 56af9a92c2
commit 6de801cd06
2 changed files with 10 additions and 2 deletions

View File

@ -44,6 +44,7 @@ go get -u -v github.com/cuu/LauncherGoDev
* https://github.com/itchyny/volume-go
* https://github.com/go-ini/ini
* github.com/cavaliercoder/grab
* github.com/yookoala/realpath
# Create “.mpd_cpi.conf” config

View File

@ -11,6 +11,9 @@ import (
"path/filepath"
//os/exec"
"encoding/json"
"github.com/yookoala/realpath"
"github.com/cuu/LauncherGoDev/sysgo/UI"
"github.com/cuu/LauncherGoDev/sysgo/UI/Emulator"
@ -145,8 +148,12 @@ func ReadTheDirIntoPages(self *UI.MainScreen, _dir string, pglevel int, cur_page
if strings.HasSuffix(strings.ToLower(f.Name()),UI.IconExt) {
i2 := self.ExtraName(f.Name())
iconitem := UI.NewIconItem()
abs_path,_ := filepath.Abs(_dir+"/"+f.Name())
iconitem.CmdPath = abs_path
rel_path,err := realpath.Realpath( _dir+"/"+f.Name() )
if err != nil {
rel_path,_ = filepath.Abs(_dir+"/"+f.Name())
}
iconitem.CmdPath = rel_path
UI.MakeExecutable( iconitem.CmdPath )
iconitem.MyType = UI.ICON_TYPES["EXE"]
if UI.FileExists( UI.SkinMap( _dir+"/"+ UI.ReplaceSuffix(i2,"png"))) {