Skip to content

Commit

Permalink
database: allow for multiple entries in a database path
Browse files Browse the repository at this point in the history
Split the given database path by colon, same as PATH behavior, to allow
callers to pass multiple database paths.
  • Loading branch information
whot committed Oct 23, 2024
1 parent a0cb6d7 commit 8250e82
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions libwacom/libwacom-database.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,10 +1132,10 @@ stylus_compare(WacomStylusId *a, WacomStylusId *b)
}

static WacomDeviceDatabase *
database_new_for_paths (const char **datadirs)
database_new_for_paths (char * const *datadirs)
{
WacomDeviceDatabase *db;
const char **datadir;
char * const *datadir;

db = g_new0 (WacomDeviceDatabase, 1);
db->device_ht = g_hash_table_new_full (g_str_hash,
Expand Down Expand Up @@ -1174,17 +1174,20 @@ database_new_for_paths (const char **datadirs)
LIBWACOM_EXPORT WacomDeviceDatabase *
libwacom_database_new_for_path (const char *datadir)
{
const char *datadirs[] = {
datadir,
NULL,
};
return database_new_for_paths(datadirs);
WacomDeviceDatabase *db;
char **paths = g_strsplit(datadir, ":", 0);

db = database_new_for_paths(paths);

g_strfreev(paths);

return db;
}

LIBWACOM_EXPORT WacomDeviceDatabase *
libwacom_database_new (void)
{
const char *datadir[] = {
char *datadir[] = {
ETCDIR,
DATADIR,
NULL,
Expand Down

0 comments on commit 8250e82

Please sign in to comment.