base-dirs: add XDG_CONFIG/DATA_DIRS and CONFIGURATION & DATA groups
This adds support for the system-wide locations for configuration and data files, as defined by the XDG Base Directory Specification. In addition, it adds two flag groups, CONFIGURATION and DATA, to the base-dirs system, so that we don't have to hard-code the combinations of flags everywhere.
This commit is contained in:
@@ -39,12 +39,8 @@ wp_lua_scripting_package_searcher (lua_State *L)
|
||||
const gchar *name = luaL_checkstring (L, 1);
|
||||
g_autoptr (GError) error = NULL;
|
||||
g_autofree gchar *filename = g_strdup_printf ("%s.lua", name);
|
||||
g_autofree gchar *script = wp_base_dirs_find_file (
|
||||
WP_BASE_DIRS_ENV_DATA |
|
||||
WP_BASE_DIRS_XDG_CONFIG_HOME |
|
||||
WP_BASE_DIRS_ETC |
|
||||
WP_BASE_DIRS_PREFIX_SHARE,
|
||||
"scripts/lib", filename);
|
||||
g_autofree gchar *script =
|
||||
wp_base_dirs_find_file (WP_BASE_DIRS_DATA, "scripts/lib", filename);
|
||||
|
||||
if (!script) {
|
||||
lua_pushliteral (L, "script not found");
|
||||
@@ -142,11 +138,7 @@ find_script (const gchar * script, WpCore *core)
|
||||
g_file_test (script, G_FILE_TEST_IS_REGULAR))
|
||||
return g_strdup (script);
|
||||
|
||||
return wp_base_dirs_find_file (WP_BASE_DIRS_ENV_DATA |
|
||||
WP_BASE_DIRS_XDG_CONFIG_HOME |
|
||||
WP_BASE_DIRS_ETC |
|
||||
WP_BASE_DIRS_PREFIX_SHARE,
|
||||
"scripts", script);
|
||||
return wp_base_dirs_find_file (WP_BASE_DIRS_DATA, "scripts", script);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user