diff --git a/go.mod b/go.mod index 2ca1179..1629a5d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/probonopd/go-appimage go 1.23 require ( - github.com/CalebQ42/squashfs v1.0.2 + github.com/CalebQ42/squashfs v1.0.4 github.com/acobaugh/osrelease v0.1.0 github.com/adrg/xdg v0.5.0 github.com/alokmenghrajani/gpgeez v0.0.0-20161206084504-1a06f1c582f9 diff --git a/go.sum b/go.sum index 46567cb..46a63ed 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ -github.com/CalebQ42/squashfs v1.0.1 h1:5FonyiIDn0RMc16Lp+bfjYBmGCVHNhQWDE2bS28PV1A= -github.com/CalebQ42/squashfs v1.0.1/go.mod h1:uhKIQfq2+dgJ+utqCkvVk0t7XuqaNhcotCrqSI0wUuI= -github.com/CalebQ42/squashfs v1.0.2 h1:r1OMSTpacV4GXOWaLwnydEpcrv+yhUSIzrvSGYO74Xg= -github.com/CalebQ42/squashfs v1.0.2/go.mod h1:uhKIQfq2+dgJ+utqCkvVk0t7XuqaNhcotCrqSI0wUuI= +github.com/CalebQ42/squashfs v1.0.4 h1:v7d6BxamgumtvqkOmezEOHmlBUGP4+Epewoin0JZ6LA= +github.com/CalebQ42/squashfs v1.0.4/go.mod h1:uhKIQfq2+dgJ+utqCkvVk0t7XuqaNhcotCrqSI0wUuI= github.com/acobaugh/osrelease v0.1.0 h1:Yb59HQDGGNhCj4suHaFQQfBps5wyoKLSSX/J/+UifRE= github.com/acobaugh/osrelease v0.1.0/go.mod h1:4bFEs0MtgHNHBrmHCt67gNisnabCRAlzdVasCEGHTWY= github.com/adrg/xdg v0.5.0 h1:dDaZvhMXatArP1NPHhnfaQUqWBLBsmx1h1HXQdMoFCY= diff --git a/src/appimaged/appwrapper.go b/src/appimaged/appwrapper.go index a1dd4a3..5ebc86a 100644 --- a/src/appimaged/appwrapper.go +++ b/src/appimaged/appwrapper.go @@ -147,17 +147,18 @@ func sendErrorDesktopNotification(title string, body string) { // which have Exec= entries pointing to the executable func findDesktopFilesPointingToExecutable(executablefilepath string) ([]string, error) { var results []string - files, e := os.ReadDir(xdg.DataHome + "/applications/") + files, e := os.ReadDir(filepath.Join(xdg.DataHome, "applications")) helpers.LogError("desktop", e) if e != nil { return results, e } for _, file := range files { if strings.HasSuffix(file.Name(), ".desktop") { + filePath := filepath.Join(xdg.DataHome, "applications", file.Name()) var cfg *ini.File info, _ := file.Info() if info.Mode()&os.ModeSymlink != 0 { // Check if it's a symlink - linkfile, err := os.Readlink(xdg.DataHome + "/applications/" + file.Name()) // Read the symlink target + linkfile, err := os.Readlink(filePath) // Read the symlink target if err != nil { log.Printf("Readlink error %s on file %s", err, linkfile) continue @@ -168,8 +169,13 @@ func findDesktopFilesPointingToExecutable(executablefilepath string) ([]string, continue } } else { // If not a symlink then load the file directly - cfg, _ = ini.LoadSources(ini.LoadOptions{IgnoreInlineComment: true}, // Do not cripple lines hat contain ";" - xdg.DataHome+"/applications/"+file.Name()) + var err error + cfg, err = ini.LoadSources(ini.LoadOptions{IgnoreInlineComment: true}, // Do not cripple lines hat contain ";" + filePath) + if err != nil { + log.Printf("ini.Load error %s on file %s", err, filePath) + continue + } } // log.Println(xdg.DataHome + "/applications/" + file.Name()) s := cfg.Section("Desktop Entry").Key("Exec").String()