Bladeren bron

add realpath over abs_path

cuu 5 jaren geleden
bovenliggende
commit
6de801cd06
2 gewijzigde bestanden met toevoegingen van 10 en 2 verwijderingen
  1. 1 0
      README.md
  2. 9 2
      mainscreen.go

+ 1 - 0
README.md

@@ -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
 

+ 9 - 2
mainscreen.go

@@ -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"))) {