Commit 8a72222d authored by Benjamin Otte's avatar Benjamin Otte

[PROGRAMS] add a -n option to gvfs-ls for nofollow-symlinks

parent 056cfe68
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment