File sytem routines.
Example (check if a file exists):
} else {
}
ssize_t M_printf(const char *fmt,...)
@ M_FS_ERROR_SUCCESS
Definition: m_fs.h:155
M_fs_error_t M_fs_perms_can_access(const char *path, M_uint32 mode)
Example (information about a file or directory):
} else {
M_printf(
"Failed to get file information\n");
}
struct M_fs_info M_fs_info_t
Definition: m_fs.h:127
@ M_FS_PATH_INFO_FLAGS_BASIC
Definition: m_fs.h:237
void M_fs_info_destroy(M_fs_info_t *info) M_FREE(1)
M_fs_error_t M_fs_info(M_fs_info_t **info, const char *path, M_uint32 flags)
const char * M_fs_info_get_user(const M_fs_info_t *info)
Example (normalize path):
const char *p1 = "./abc def/../xyz/./1 2 3/./xyr/.";
const char *n1 = "xyz/1 2 3/xyr";
const char *p2 = "C:\\\\var\\log\\.\\mysql\\\\\\5.1\\..\\..\\mysql.log";
const char *n2 = "C:\\var\\log\\mysql.log";
char *out = NULL;
} else {
M_printf(
"p1 did not normalize correctly\n");
}
} else {
}
} else {
M_printf(
"p2 did not normalize correctly\n");
}
} else {
}
@ M_FS_PATH_NORM_ABSOLUTE
Definition: m_fs.h:215
@ M_FS_PATH_NORM_NONE
Definition: m_fs.h:214
@ M_FS_SYSTEM_WINDOWS
Definition: m_fs.h:369
@ M_FS_SYSTEM_UNIX
Definition: m_fs.h:370
M_fs_error_t M_fs_path_norm(char **out, const char *path, M_uint32 flags, M_fs_system_t sys_type)
void M_free(void *ptr) M_FREE(1)
M_bool M_str_eq(const char *s1, const char *s2)
Example (listing files in a directory):
size_t len;
size_t i;
for (i=0; i<len; i++) {
}
@ M_FS_DIR_WALK_FILTER_READ_INFO_BASIC
Definition: m_fs.h:316
@ M_FS_DIR_WALK_FILTER_FILE
Definition: m_fs.h:291
M_list_str_t * M_fs_dir_walk_strs(const char *path, const char *pat, M_uint32 filter)
const char * M_list_str_at(const M_list_str_t *d, size_t idx)
struct M_list_str M_list_str_t
Definition: m_list_str.h:80
void M_list_str_destroy(M_list_str_t *d) M_FREE(1)
size_t M_list_str_len(const M_list_str_t *d)