Icon location with Meson build variables

The Flatpak documents https://docs.flatpak.org/en/latest/conventions.html#expected-standards
say icons should be in:
/app/share/ icons/hicolor/128x128/apps/org.gnome.Dictionary.png
There is no such directory on my PC, even though I have several Flatpaks installed!

Meson puts them elsewhere, getting the directory from a variable called datadir, which I believe it gets from a configuration file called mesonconf - this is on the server doing the building, so is presumably set by Flathub:
/var/lib/flatpak/exports/share/ icons/hicolor/128x128/apps/com.github.{repo}.{app}.png

The Flatpak has been published, and it all works, the icon shows on the menu, except that Plank can’t find it.

Why is there a difference between what happens and what the docs say should happen?
Do I give up and put a copy somewhere else especially for Plank?

Hi
There’s no /app directory on a normal Linux system. However, all Flatpak app containers do have a /app directory. If you open a shell in any of your Flatpak apps (something like flatpak run --command/bin/bash org.gnome.Nautilus) you’ll see it.

For Meson to install in this directory you need to configure with --prefix=/app. The flatpak-builder ‘meson’ build type should do this automatically – are you using that in the app manifest?

That’s important information, it explains why I can’t see ‘/app’. I had noticed that when I built it locally there was a directory for the Flatpak, but when installed from Flathub only a couple of bits and pieces. I stopped worrying about that because there were more important problems to deal with…
The example command is unknown and I can’t see a likely command with ‘flatpak --help’. It would be very useful to be able to see exactly how things are set up.
The OS obviously needs to find the desktop file outside the container to be able to start it, and it does, it shows on the menu with its correct icon. Presumably installing Flatpak informs the OS where to find it. It’s in:
/home/chris/flatpak/export/share/applications
and
/home/chris/flatpak/files/share/applications
So it is odd that Plank does not find it, I have found a similar situation with other applications.

configure with --prefix=/app
No, but the Meson variables seem to mostly do the right thing as the application works.

project(
      'myapp',
      version: '0.0.0',
      meson_version: '>= 0.46.0'
    )

    bindir = get_option('bindir')
    datadir = get_option('datadir')
    pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'myapp')

    conf = configuration_data()
    conf.set('pkgdatadir', pkgdatadir)

    configure_file(
      input: 'myapp.in',
      output: 'myapp',
      configuration: conf,
      install_dir: bindir
    )

    data_files = [
      'myapp.glade',  
      'myapp.png'
    ]

    foreach file : data_files
      install_data(file, install_dir: pkgdatadir)
    endforeach

    install_data(
      'com.github.mysoftware.myapp.desktop',
      install_dir: join_paths(datadir, 'applications')
    )
    install_data(
      'myapp.png', rename : 'com.github.mysoftware.myapp.png',
      install_dir: join_paths(datadir, 'icons', 'hicolor', '128x128', 'apps')
    )
    install_data(
      'myapp64x64.png', rename : 'com.github.mysoftware.myapp.png',
      install_dir: join_paths(datadir, 'icons', 'hicolor', '64x64', 'apps')  
    )
    install_data(
    	'com.github.mysoftware.myapp.appdata.xml',
      install_dir: join_paths(datadir, 'metainfo')  
    )

It seems that all I needed to do was put the full application name in the .desktop file, but without the .png at the end. The flatpak-builder no longer complains, although I can’t see how to test it on Fedora.

Icon=com.github.mysoftware.myapp