g_file_test () gboolean g_file_test (const gchar *filename, GFileTest test); Returns TRUE if any of the tests in the bitfield test are TRUE. 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.
Another thing to note is that G_FILE_TEST_EXISTS and G_FILE_TEST_IS_EXECUTABLE are implemented using the access() system call. This usually doesn’t matter, but if your program is setuid or setgid it means that these tests will give you the answer for the real user ID and group ID, rather than the effective user ID and group ID.
g_file _test #define g_file _test. Returns TRUE if any of the tests in the bitfield test are TRUE.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.
Another thing to note is that G_FILE_TEST_EXISTS and G_FILE_TEST_IS_EXECUTABLE are implemented using the access() system call. This usually doesn’t matter, but if your program is setuid or setgid it means that these tests will give you the answer for the real user ID and group ID, rather than the effective user ID and group ID.
if (! g_file_test (file, G_FILE_TEST_EXISTS)) /* The intention of calling `g_file_test (file, G_FILE_TEST_EXISTS)` is * to speed up probing for non-existent libraries. The problem is that * if file is just a simple libdl.so then `dlopen (file)` doesn’t just * look for it in the current working directory, it will probe some * other paths too.
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.
Another thing to note is that g_file_test_exists and g_file_test_is_executable are implemented using the access system call. This usually doesn’t matter, but if your program is setuid or setgid it means that these tests will give you the answer for the real user ID and group.
Returns TRUE if any of the tests in the bitfield test are TRUE.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. Apart from G_FILE _TEST_IS_SYMLINK all tests follow symbolic …
g_file_ exists is deprecated and should not be used in newly-written code. Programs should use g_file _test(filename, G_FILE _TEST_ EXISTS ) instead of this function. filename : Filename. Returns : Returns TRUE if filename exists , FALSE otherwise. g_unix_error_string(), g_file _test function should take a full path filename, so in create_database function, two g_file _test will return false and then use : query= g_strdup_ printf( CREATE DATABASE `%s`, db ? db : database);