From 882084a04ae9bec00e510a2319feba1d1a653fb1 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Fri, 24 Jun 2022 23:50:38 +0900 Subject: datadir: Use bundle mechanism softmmu/datadir.c had its own implementation to find files in the build tree, but now bundle mechanism provides the unified implementation which works for datadir and the other files. Signed-off-by: Akihiko Odaki Message-Id: <20220624145039.49929-4-akihiko.odaki@gmail.com> Signed-off-by: Paolo Bonzini --- softmmu/datadir.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'softmmu') diff --git a/softmmu/datadir.c b/softmmu/datadir.c index 160cac999a..697cffea93 100644 --- a/softmmu/datadir.c +++ b/softmmu/datadir.c @@ -83,26 +83,6 @@ void qemu_add_data_dir(char *path) data_dir[data_dir_idx++] = path; } -/* - * Find a likely location for support files using the location of the binary. - * When running from the build tree this will be "$bindir/pc-bios". - * Otherwise, this is CONFIG_QEMU_DATADIR (possibly relocated). - * - * The caller must use g_free() to free the returned data when it is - * no longer required. - */ -static char *find_datadir(void) -{ - g_autofree char *dir = NULL; - - dir = g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL); - if (g_file_test(dir, G_FILE_TEST_IS_DIR)) { - return g_steal_pointer(&dir); - } - - return get_relocated_path(CONFIG_QEMU_DATADIR); -} - void qemu_add_default_firmwarepath(void) { char **dirs; @@ -116,7 +96,7 @@ void qemu_add_default_firmwarepath(void) g_strfreev(dirs); /* try to find datadir relative to the executable path */ - qemu_add_data_dir(find_datadir()); + qemu_add_data_dir(get_relocated_path(CONFIG_QEMU_DATADIR)); } void qemu_list_data_dirs(void) -- cgit v1.2.3 From 8154f5e64b0cfb836803ec6c11360075be66cd00 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sat, 25 Jun 2022 00:40:42 +0900 Subject: meson: Prefix each element of firmware path Signed-off-by: Akihiko Odaki Message-Id: <20220624154042.51512-1-akihiko.odaki@gmail.com> [Rewrite shell function without using Bash extensions. - Paolo] Signed-off-by: Paolo Bonzini --- softmmu/datadir.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'softmmu') diff --git a/softmmu/datadir.c b/softmmu/datadir.c index 697cffea93..c9237cb5d4 100644 --- a/softmmu/datadir.c +++ b/softmmu/datadir.c @@ -85,15 +85,17 @@ void qemu_add_data_dir(char *path) void qemu_add_default_firmwarepath(void) { - char **dirs; + static const char * const dirs[] = { + CONFIG_QEMU_FIRMWAREPATH + NULL + }; + size_t i; /* add configured firmware directories */ - dirs = g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S, 0); for (i = 0; dirs[i] != NULL; i++) { qemu_add_data_dir(get_relocated_path(dirs[i])); } - g_strfreev(dirs); /* try to find datadir relative to the executable path */ qemu_add_data_dir(get_relocated_path(CONFIG_QEMU_DATADIR)); -- cgit v1.2.3