modules: fix g_file_test for regular files
From the g_file_test documentation: "For example, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) will return TRUE if the file exists; the check whether it's a directory doesn't matter since the existence test is TRUE. With the current set of available tests, there's no point passing in more than one test at a time."
This commit is contained in:

committed by
George Kiagiadakis

parent
2792cecbcf
commit
1132b37f0b
@@ -128,7 +128,7 @@ static gchar *
|
||||
find_script (const gchar * script, gboolean daemon)
|
||||
{
|
||||
if ((!daemon || g_path_is_absolute (script)) &&
|
||||
g_file_test (script, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
|
||||
g_file_test (script, G_FILE_TEST_IS_REGULAR))
|
||||
return g_strdup (script);
|
||||
|
||||
/* /etc/wireplumber/scripts */
|
||||
@@ -138,7 +138,7 @@ find_script (const gchar * script, gboolean daemon)
|
||||
|
||||
wp_trace ("trying %s", file);
|
||||
|
||||
if (g_file_test (file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
|
||||
if (g_file_test (file, G_FILE_TEST_IS_REGULAR))
|
||||
return g_steal_pointer (&file);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ find_script (const gchar * script, gboolean daemon)
|
||||
|
||||
wp_trace ("trying %s", file);
|
||||
|
||||
if (g_file_test (file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
|
||||
if (g_file_test (file, G_FILE_TEST_IS_REGULAR))
|
||||
return g_steal_pointer (&file);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ find_script (const gchar * script, gboolean daemon)
|
||||
|
||||
wp_trace ("trying %s", file);
|
||||
|
||||
if (g_file_test (file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
|
||||
if (g_file_test (file, G_FILE_TEST_IS_REGULAR))
|
||||
return g_steal_pointer (&file);
|
||||
}
|
||||
return NULL;
|
||||
|
@@ -95,7 +95,7 @@ wp_lua_scripting_load_configuration (const gchar * conf_file,
|
||||
|
||||
/* load conf_file itself */
|
||||
path = g_build_filename (wp_get_config_dir (), conf_file, NULL);
|
||||
if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) {
|
||||
wp_info ("loading config file: %s", path);
|
||||
if (!wplua_load_path (L, path, 0, 0, error))
|
||||
return FALSE;
|
||||
|
Reference in New Issue
Block a user