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

Add support for metainfo.xml #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Rosalie241
Copy link

This adds support for metainfo.xml, appdata.xml is still supported though.

see https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#spec-component-location

@probonopd
Copy link
Member

Thanks @Rosalie241. Not sure we want this ambiguity in AppImages, though. After all, if we allow 2 different file paths in AppImages, then all tools that verify AppImages or integrate them into the system would have to check 2 different file paths as well.

@Rosalie241
Copy link
Author

Thanks @Rosalie241. Not sure we want this ambiguity in AppImages, though. After all, if we allow 2 different file paths in AppImages, then all tools that verify AppImages or integrate them into the system would have to check 2 different file paths as well.

Tools which want to support normal desktop applications that provide a metainfo/appdata.xml file will also have to check 2 paths though, so I'm not sure if it's a big problem, but I've updated my application (RMG) to use the new metainfo.xml file according to the freedesktop appstream documentation, and now the appimagetool cannot find the appstream data, which isn't ideal either.

@probonopd
Copy link
Member

Maybe we should just put in a symlink? That would be backwards compatible.

@Rosalie241
Copy link
Author

That could be an option but I'm not sure how to do that with the APIs available.

@probonopd
Copy link
Member

Something roughly along these lines?

package main

import (
	"fmt"
	"log"
	"os"
)

func main() {
	metainfoPath := "usr/share/metainfo/metainfo.xml"
	appdataPath := "usr/share/metainfo/appdata.xml"

	// Check if metainfo.xml exists
	if _, err := os.Stat(metainfoPath); os.IsNotExist(err) {
		fmt.Println(metainfoPath, "does not exist, creating symlink to", appdataPath)

		// Create symlink from appdata.xml to metainfo.xml
		if err := os.Symlink(appdataPath, metainfoPath); err != nil {
			log.Fatalf("Failed to create symlink from %s to %s: %v", appdataPath, metainfoPath, err)
		} else {
			fmt.Println("Symlink created from", appdataPath, "to", metainfoPath)
		}
	} else {
		fmt.Println(metainfoPath, "exists")
	}

	// Check if appdata.xml exists
	if _, err := os.Stat(appdataPath); os.IsNotExist(err) {
		fmt.Println(appdataPath, "does not exist, creating symlink to", metainfoPath)

		// Create symlink from metainfo.xml to appdata.xml
		if err := os.Symlink(metainfoPath, appdataPath); err != nil {
			log.Fatalf("Failed to create symlink from %s to %s: %v", metainfoPath, appdataPath, err)
		} else {
			fmt.Println("Symlink created from", metainfoPath, "to", appdataPath)
		}
	} else {
		fmt.Println(appdataPath, "exists")
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants