os_calls: Add g_executable_exist()

This commit is contained in:
matt335672
2023-04-03 15:09:31 +01:00
parent ff24984cf3
commit 65ff618479
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -2556,6 +2556,14 @@ g_directory_exist(const char *dirname)
#endif
}
/*****************************************************************************/
/* returns boolean, non zero if the file exists and is a readable executable */
int
g_executable_exist(const char *exename)
{
return access(exename, R_OK | X_OK) == 0;
}
/*****************************************************************************/
/* returns boolean */
int
+1
View File
@@ -242,6 +242,7 @@ int g_set_current_dir(const char *dirname);
int g_file_exist(const char *filename);
int g_file_readable(const char *filename);
int g_directory_exist(const char *dirname);
int g_executable_exist(const char *dirname);
int g_create_dir(const char *dirname);
int g_create_path(const char *path);
int g_remove_dir(const char *dirname);