예제 #1
0
void		get_dir_elem(t_env *e, DIR *directory, char *path)
{
	struct dirent	*elem;
	char			*new_path;
	int				fd;
	struct stat		st;

	while ((elem = readdir(directory)) != NULL)
	{
		new_path = storage_path(path, elem->d_name);
		if ((fd = open(new_path, O_RDONLY)) != (-1))
		{
			if ((fstat(fd, &st)) != 0)
				error_call_system("fstat");
			if (S_ISREG(st.st_mode) && elem->d_name[0] != '.')
			{
				++(e->nb_files);
				storage_file(&(e->m), fd, st.st_size, elem->d_name);
			}
			if ((close(fd)) != 0)
				error_call_system("close");
		}
		ft_strdel(&(new_path));
	}
}
예제 #2
0
	std::string storage_moved_alert::message() const
	{
		return torrent_alert::message() + " moved storage to: "
			+ storage_path();
	}