Data Files

The data directory contains files that are not included in the resource file that is used by the application. These files will be installed to standard locations in the filing system, such as /usr/share/icons and the application’s own installation directory.

Name

Purpose

icons/hicolor/scalable/apps

A directory containing the icon for the application.

images

A directory containing images used in the application.

meson.build

The build file for the data directory.

com.example.treasure.appdata.xml.in

An AppStream metadata file.

com.example.treasure.desktop.in

An Desktop Entry file.

The icons directory in this example contains a deeply-nested set of directories with a Scalable Vector Graphics (SVG) file called treasure.svg inside them. This reflects the structure of the directories where application icons are stored by the system but, for simple applications like this one, the icon could be kept in the data directory itself. The meson.build file contains a rule for installing this directory structure in the correct place.

The images directory contains the images that the application uses for the tiles in the game. Instead of handling each SVG individually, the meson.build file contains a rule for installing the whole images directory to the application’s installation directory.

Additional Files

There are two additional files that appear in the data directory. Both of these are templates that will be processed to produce files that can be installed.

The com.example.treasure.appdata.xml.in file is a template of an AppStream file, containing metadata including the license of the application and a short piece of text describing what it does:

<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
    <id>com.example.treasure.desktop</id>
    <metadata_license>CC0-1.0</metadata_license>
    <project_license>GPL-3.0-or-later</project_license>
    <description>
        A simple guessing game.
    </description>
</component>

Although this file was written by hand, AppStream files can also be created using tools such as the AppStream MetaInfo Creator web application.

The com.example.treasure.desktop.in file is a template of a Desktop Entry file that application launchers can use to show information about the application, including its name, icon and the name of its executable file:

[Desktop Entry]
Name=Treasure
Icon=com.example.treasure
Exec=treasure
Terminal=false
Type=Application
Categories=Game
StartupNotify=false

When the build system runs, these files are processed to create com.example.treasure.appdata.xml and com.example.treasure.desktop files that can be packaged for installation on users’ systems.