Skip to content

Commit 3ebfbb3

Browse files
committed
Update icon and desktop caches when installing
1 parent 74c51fe commit 3ebfbb3

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

meson.build

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ config_h_dir = include_directories('.')
1111

1212
subdir('data')
1313
subdir('src')
14+
15+
meson.add_install_script('meson/post_install.py')
16+

meson/post_install.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import subprocess
5+
6+
prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
7+
datadir = os.path.join(prefix, 'share')
8+
schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
9+
10+
# Packaging tools define DESTDIR and this isn't needed for them
11+
if 'DESTDIR' not in os.environ:
12+
print('Updating icon cache...')
13+
icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')
14+
if not os.path.exists(icon_cache_dir):
15+
os.makedirs(icon_cache_dir)
16+
subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])
17+
18+
print('Updating desktop database...')
19+
desktop_database_dir = os.path.join(datadir, 'applications')
20+
if not os.path.exists(desktop_database_dir):
21+
os.makedirs(desktop_database_dir)
22+
subprocess.call(['update-desktop-database', '-q', desktop_database_dir])
23+

0 commit comments

Comments
 (0)