Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #323 #324

Merged
merged 2 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
14 changes: 10 additions & 4 deletions src/appimaged/appwrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down