Re: File manager tree.
- From: "Marcelo de G. Malheiros" <malheiro dca fee unicamp br>
- To: gnome-list gnome org
- Subject: Re: File manager tree.
- Date: Fri, 28 May 1999 23:15:47 -0300
On Fri, May 28 1999, Miguel de Icaza wrote:
> The big problem here is that in order to achieve (1) you need to
> do a 2-level scan of the directories: one pass to scan all the names
> returned and stat the thing to figure out if the name is a directory,
> or if it is a file (ie, if it is a subdirectory, we need to scan the
> child to see if it has directories, in that case, we need to stick a
> [+] sign there).
Pardon me if I am saying something stupid, but can't you figure out
if a directory has subdirs only by looking at its link count, as
returned by stat()? I guess this works for all UNIX-like filesystems.
An empty subdirectory always have a count of 2 (its entry at the
parent and the self '.' reference). Any count greater than 3 means
there is at least one subdirectory, as can be confirmed with a "ls -la".
Of course the root directory does not have the parent reference, but
you can safely assume it have a few subdirs. =)
Marcelo
--
Marcelo de Gomensoro Malheiros -- malheiro@dca.fee.unicamp.br
---- THE LINUX FILES - The Source Is Out There ----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]