1
0
forked from drath/libratbag

Install the device files in the top-level datadir

Now that the SVGs are gone, we don't need the subfolder anymore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2019-03-05 12:52:20 +10:00
committed by Benjamin Tissoires
parent b2a3d39122
commit 336440cddb
3 changed files with 6 additions and 9 deletions

View File

@@ -34,7 +34,7 @@ libratbag_references:
name: Checking installation
command: |
PREFIX=/usr/local/
diff -u <(cd data/devices; ls *.device) <(cd $PREFIX/share/libratbag/devices; ls *.device)
diff -u <(cd data/devices; ls *.device) <(cd $PREFIX/share/libratbag; ls *.device)
check_uninstall: &check_uninstall
run:
name: Checking if any files are left after uninstall

View File

@@ -43,7 +43,7 @@ config_h.set_quoted('FALLBACK_SVG_NAME', 'fallback.svg')
libratbag_data_dir = join_paths(get_option('prefix'),
get_option('datadir'),
'libratbag')
libratbag_data_dir_devel = join_paths(meson.source_root(), 'data')
libratbag_data_dir_devel = join_paths(meson.source_root(), 'data', 'devices')
config_h.set_quoted('LIBRATBAG_DATA_DIR', libratbag_data_dir)
# Coverity breaks because it doesn't define _Float128 correctly, you'll end
@@ -316,7 +316,7 @@ data_files = files(
)
install_data(data_files,
install_dir : join_paths(get_option('datadir'), 'libratbag', 'devices'))
install_dir : join_paths(get_option('datadir'), 'libratbag'))
data_parse_test = find_program(join_paths(meson.source_root(), 'data/devices/data-parse-test.py'))
test('data-parse-test', data_parse_test, args: data_files)

View File

@@ -465,19 +465,16 @@ ratbag_device_data_new_for_id(struct ratbag *ratbag, const struct input_id *id)
struct dirent **files;
int n, nfiles;
const char *datadir;
char devicedir[PATH_MAX] = {0};
datadir = getenv("LIBRATBAG_DATA_DIR");
if (!datadir)
datadir = LIBRATBAG_DATA_DIR;
log_debug(ratbag, "Using data directory '%s'\n", datadir);
snprintf(devicedir, sizeof(devicedir), "%s/devices", datadir);
n = scandir(devicedir, &files, filter_device_files, alphasort);
n = scandir(datadir, &files, filter_device_files, alphasort);
if (n <= 0) {
log_error(ratbag, "Unable to locate device files in %s: %s\n",
devicedir, n == 0 ? "No files found" : strerror(errno));
datadir, n == 0 ? "No files found" : strerror(errno));
return NULL;
}
@@ -486,7 +483,7 @@ ratbag_device_data_new_for_id(struct ratbag *ratbag, const struct input_id *id)
_cleanup_(freep) char *file = NULL;
int rc;
rc = xasprintf(&file, "%s/%s", devicedir, files[n]->d_name);
rc = xasprintf(&file, "%s/%s", datadir, files[n]->d_name);
if (rc == -1)
goto out;
if (file_data_matches(ratbag, file, id, &data))