Enviado em 22/10/2018 - 18:25h
Olá a todos!{
struct dirent **namelist;
int n,i;
if (!entry || !container)
return;
n = scandir (container, &namelist, 0, alphasort);
if (n < 0)
{
perror ("scandir");
return;
}
for (i = 0; i < n; i++)
{
struct stat st;
char *fullpath = NULL;
if (namelist[i]->d_name[0] == '.')
{
free (namelist[i]);
continue;
}
fullpath = (char *)
malloc (strlen (container) + strlen (namelist[i]->d_name) + 2);
sprintf (fullpath, "%s/%s", container, namelist[i]->d_name);
log_verbose ("%s\n", fullpath);
if (stat (fullpath, &st) < 0)
{
free (namelist[i]);
free (fullpath);
continue;
}
if (S_ISDIR (st.st_mode))
{
struct upnp_entry_t *child = NULL;
child = upnp_entry_new (ut, namelist[i]->d_name,
fullpath, entry, 0, true);
if (child)
{
metadata_add_container (ut, child, fullpath);
upnp_entry_add_child (ut, entry, child);
}
}
else
metadata_add_file (ut, entry, fullpath, namelist[i]->d_name, &st);
free (namelist[i]);
free (fullpath);
}
free (namelist);
}
tux-gpt - Assistente de IA para o Terminal
Instalação e configuração do Chrony
Programa IRPF - Guia de Instalação e Resolução de alguns Problemas
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
O Que Fazer Após Instalar Ubuntu 25.04
Copiar Layout do Teclado para aplicar em outra Distribuição (6)
Alguém poderia me ajudar a escolher peças pra montar um desktop? [RESO... (34)