base/fs/m_fs_path_norm.c
/* Remove a parent directory from the list of dirs. */
Remove a parent directory from the list of dirs.
Remove a parent directory from the list of dirs .
static void M_fs_path_norm_remove_parent(M_list_str_t **dirs, M_fs_system_t sys_type)
{
	const char *last;
	size_t      len;
	if (dirs == NULL || *dirs == NULL) {
		return;
	}
	len = M_list_str_len(*dirs);
	if (len == 0) {
		M_list_str_insert(*dirs, "..");
		return;
	}
	last = M_list_str_at(*dirs, len-1);
	if ((sys_type == M_FS_SYSTEM_WINDOWS && M_fs_path_isabs(last, sys_type)) || (*last == '\0')) {
		return;
	}
	if (M_str_eq(last, "..")) {
		M_list_str_insert(*dirs, "..");
	} else {
		M_list_str_remove_at(*dirs, len-1);
	}
}
static void M_fs_path_norm_remove_parent ( M_list_str_t * * dirs , M_fs_system_t sys_type ) { const char * last ; size_t len ; if ( dirs == NULL || * dirs == NULL ) { return ; } len = M_list_str_len ( * dirs ) ; if ( len == 0 ) { M_list_str_insert ( * dirs , " " ) ; return ; } last = M_list_str_at ( * dirs , len - 1 ) ; if ( ( sys_type == M_FS_SYSTEM_WINDOWS && M_fs_path_isabs ( last , sys_type ) ) || ( * last == ' \0 ' ) ) { return ; } if ( M_str_eq ( last , " " ) ) { M_list_str_insert ( * dirs , " " ) ; } else { M_list_str_remove_at ( * dirs , len - 1 ) ; } }
Remove a parent directory from the list of dirs.
Remove a parent directory from the list of dirs .
/* We don't have anyting before to remove so it's a relative path. Add ..
	 * to the dirs because we don't want to lose that we need to move up. */ /* We don't want to remove the root if this already an abs path. */ /* Add .. if we already have .. or remove the last path. */