probonopd / go-appimage

Go implementation of AppImage tools
MIT License
756 stars 74 forks source link

fix(appimaged): avoid 'Invalid desktop file' error on Debian #274

Closed Cobraeti closed 6 months ago

Cobraeti commented 6 months ago

This change should fix #273

CalebQ42 commented 6 months ago

It's better to use filepath.Join instead of string concatenation to make sure there aren't any double slashes.

Cobraeti commented 6 months ago

I'm out this afternoon, I will try to make this rework tomorrow, thanks for the head-up 😉

Cobraeti commented 6 months ago

Hi @CalebQ42, I just pushed the rework and also added surrounding quotes in case os.UserHomeDir could contain spaces (even if I hope this won't happen anywhere 😅)

Cobraeti commented 6 months ago

I will check why the pipeline failed, but that might take a while, as I don't have a Go environnement setup ATM 😅

Cobraeti commented 6 months ago

After reading the pipeline error a few more times I think I figured the error => I passed the already concacenated string instead of a list of strings... I hope that's enough to build, else I will really need to setup this Go environnement and check all build steps on my side to avoid bothering you 😅

CalebQ42 commented 6 months ago

I've been a bit busy so I didn't catch it initially, but os.UserHomeDir() returns two values so you can't inline it. Instead you'll need to set the values to a variable before you can use it.

Cobraeti commented 6 months ago

Hi @CalebQ42, I took the time to setup GoLand and it helped me even notice that a variable home catching the good part of os.UserHomeDir() was already defined in the main package: https://github.com/probonopd/go-appimage/blob/09fd0186774aefa2351c42b4bb22f92ce0c4f235/src/appimaged/appimaged.go#L76 I'm not sure if it's a good practice though, but I was able to compile and push it on my target system to confirm the error is now gone...

Just in case, as I was not able to replicate the exact context of the Github Workflow to build:

probonopd commented 6 months ago

Thank you very much @Cobraeti