mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
database: drop arch from newly created database file name
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/425>
This commit is contained in:
parent
ae9d0cf307
commit
4ca8997aa0
1 changed files with 29 additions and 27 deletions
|
|
@ -50,13 +50,13 @@ pa_database* pa_database_open(const char *path, const char *fn, bool prependmid,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* We include the host identifier in the file name because some database files are
|
||||
* CPU dependent, and we don't want things to go wrong if we are on a multiarch system. */
|
||||
filename_prefix = pa_sprintf_malloc("%s%s%s%s%s",
|
||||
machine_id?:"", machine_id?"-":"",
|
||||
fn,
|
||||
arch_suffix?".":"", arch_suffix?:"");
|
||||
/* Database file name starts with ${machine_id}-${fn} */
|
||||
if (machine_id)
|
||||
filename_prefix = pa_sprintf_malloc("%s-%s", machine_id, fn);
|
||||
else
|
||||
filename_prefix = pa_xstrdup(fn);
|
||||
|
||||
if (arch_suffix) {
|
||||
/* Search for existing database directory entry name matching architecture suffix and filename suffix. */
|
||||
database_dir = opendir(path);
|
||||
|
||||
|
|
@ -73,15 +73,16 @@ pa_database* pa_database_open(const char *path, const char *fn, bool prependmid,
|
|||
break;
|
||||
}
|
||||
|
||||
if (pa_startswith(de->d_name, filename_prefix) && pa_endswith(de->d_name + strlen(filename_prefix), filename_suffix)) {
|
||||
/* candidate filename found, replace filename_prefix with this one if match is not exact */
|
||||
if (pa_startswith(de->d_name, filename_prefix)
|
||||
&& de->d_name[strlen(filename_prefix)] == '.'
|
||||
&& pa_startswith(de->d_name + strlen(filename_prefix) + 1, arch_suffix)
|
||||
&& pa_endswith(de->d_name + strlen(filename_prefix) + 1 + strlen(arch_suffix), filename_suffix)) {
|
||||
|
||||
/* candidate filename found, replace filename_prefix with this one */
|
||||
|
||||
if (strlen(de->d_name) != strlen(filename_prefix) + strlen(filename_suffix)) {
|
||||
pa_log_debug("Found compatible database file '%s/%s', using it", path, de->d_name);
|
||||
pa_xfree(filename_prefix);
|
||||
filename_prefix = pa_xstrndup(de->d_name, strlen(de->d_name) - strlen(filename_suffix));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -90,6 +91,7 @@ pa_database* pa_database_open(const char *path, const char *fn, bool prependmid,
|
|||
} else {
|
||||
pa_log_warn("Unable to search for compatible database file, failed to open directory %s: %s", path, pa_cstrerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
full_path = pa_sprintf_malloc("%s" PA_PATH_SEP "%s%s", path, filename_prefix, filename_suffix);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue