diff options
author | Benjamin Otte <otte@gnome.org> | 2009-06-17 15:11:18 +0200 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2009-06-17 15:11:18 +0200 |
commit | 8a72222d454bdf12e88402b2f012667e7c8e9754 (patch) | |
tree | c716d81b4f9d20971cf3510769bc6ef50541449f /programs | |
parent | 056cfe684e3db4f83c176bb723c264ecfe60837f (diff) | |
download | gvfs-8a72222d454bdf12e88402b2f012667e7c8e9754.tar.gz |
[PROGRAMS] add a -n option to gvfs-ls for nofollow-symlinks
Diffstat (limited to 'programs')
-rw-r--r-- | programs/gvfs-ls.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/programs/gvfs-ls.c b/programs/gvfs-ls.c index ecc136d3..f817e63b 100644 --- a/programs/gvfs-ls.c +++ b/programs/gvfs-ls.c @@ -31,6 +31,7 @@ static char *attributes = NULL; static gboolean show_hidden = FALSE; static gboolean show_long = FALSE; +static gboolean nofollow_symlinks = FALSE; static char *show_completions = NULL; static GOptionEntry entries[] = @@ -39,6 +40,7 @@ static GOptionEntry entries[] = { "hidden", 'h', 0, G_OPTION_ARG_NONE, &show_hidden, "Show hidden files", NULL }, { "long", 'l', 0, G_OPTION_ARG_NONE, &show_long, "Use a long listing format", NULL }, { "show-completions", 'c', 0, G_OPTION_ARG_STRING, &show_completions, "Show completions", NULL}, + { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, "Don't follow symlinks", NULL}, { NULL } }; @@ -137,7 +139,11 @@ list (GFile *file) return; error = NULL; - enumerator = g_file_enumerate_children (file, attributes, 0, NULL, &error); + enumerator = g_file_enumerate_children (file, + attributes, + nofollow_symlinks ? G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS : 0, + NULL, + &error); if (enumerator == NULL) { g_printerr ("Error: %s\n", error->message); @@ -328,7 +334,7 @@ print_completions (const char *arg) enumerator = g_file_enumerate_children (parent, G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE, - 0, + nofollow_symlinks ? G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS : 0, NULL, NULL); if (enumerator != NULL) |