[nautilus-actions] na_core_utils_dir_list_perms: new function
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] na_core_utils_dir_list_perms: new function
- Date: Tue, 6 Dec 2011 23:32:45 +0000 (UTC)
commit a37b4567c6ef3966e598d6db98c1fe266187c4be
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Dec 7 00:28:55 2011 +0100
na_core_utils_dir_list_perms: new function
ChangeLog | 3 +++
src/api/na-core-utils.h | 5 +++--
src/core/na-core-utils.c | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 47e3b4b..d1b07ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2011-12-06 Pierre Wieser <pwieser trychlos org>
+ * src/api/na-core-utils.h:
+ * src/core/na-core-utils.c (na_core_utils_dir_list_perms): New function.
+
* src/nact/nact-tree-model-dnd.c (drop_uri_list):
Fix and improve error messages during drop operations.
diff --git a/src/api/na-core-utils.h b/src/api/na-core-utils.h
index f9bbcb4..af6af73 100644
--- a/src/api/na-core-utils.h
+++ b/src/api/na-core-utils.h
@@ -83,9 +83,10 @@ void na_core_utils_selcount_get_ope_int( const gchar *selection_count, gchar
/* directory management
*/
+void na_core_utils_dir_list_perms ( const gchar *path, const gchar *message );
gboolean na_core_utils_dir_is_writable_path( const gchar *path );
-gboolean na_core_utils_dir_is_writable_uri( const gchar *uri );
-void na_core_utils_dir_split_ext( const gchar *string, gchar **first, gchar **ext );
+gboolean na_core_utils_dir_is_writable_uri ( const gchar *uri );
+void na_core_utils_dir_split_ext ( const gchar *string, gchar **first, gchar **ext );
/* file management
*/
diff --git a/src/core/na-core-utils.c b/src/core/na-core-utils.c
index e71ea3b..09409b1 100644
--- a/src/core/na-core-utils.c
+++ b/src/core/na-core-utils.c
@@ -809,6 +809,40 @@ na_core_utils_selcount_get_ope_int( const gchar *selcount, gchar **ope, gchar **
}
/**
+ * na_core_utils_dir_list_perms:
+ * @path: the path of the directory to be tested.
+ * @message: a message to be printed if not %NULL.
+ *
+ * Displays the permissions of the directory on debug output.
+ *
+ * Since: 3.1
+ */
+void
+na_core_utils_dir_list_perms( const gchar *path, const gchar *message )
+{
+ static const gchar *thisfn = "na_core_utils_dir_list_perms";
+ gchar *cmd;
+ gchar *out, *err;
+ GError *error;
+
+ error = NULL;
+ cmd = g_strdup_printf( "ls -ld %s", path );
+
+ if( !g_spawn_command_line_sync( cmd, &out, &err, NULL, &error )){
+ g_warning( "%s: %s", thisfn, error->message );
+ g_error_free( error );
+
+ } else {
+ g_debug( "%s: dir=%s, message=%s, out=%s", thisfn, path, message, out );
+ g_debug( "%s: dir=%s, message=%s, err=%s", thisfn, path, message, err );
+ g_free( out );
+ g_free( err );
+ }
+
+ g_free( cmd );
+}
+
+/**
* na_core_utils_dir_is_writable_path:
* @path: the path of the directory to be tested.
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]