Re: possible optimization
- From: Federico Mena Quintero <federico ximian com>
- To: Alexander Larsson <alexl redhat com>
- Cc: "gnome-vfs-list gnome org" <gnome-vfs-list gnome org>, Nautilus <nautilus-list gnome org>, "release-team gnome org" <release-team gnome org>
- Subject: Re: possible optimization
- Date: Mon, 27 Feb 2006 12:31:28 -0600
On Mon, 2006-02-27 at 18:59 +0100, Alexander Larsson wrote:
> > You don't even need the names. stat("/some/directory") will give you
> > the number of entries in the directory in the st_nlink field. An empty
> > directory has st_nlink=2 because of "." and "..". This is useful for
> > non-deep counts.
>
> Hmm. This is interesting. How portable is this amongst filesystems? (Of
> course, it'll only work for file:/// files.)
Crap, I lied :) st_nlink for a directory gives you the number of
*subdirectories*, including . and ..
This is what we used in GMC to know when to display an expander in the
folder tree.
Sorry for the confusion,
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]