Re: File copying



On Mon, 7 Feb 2011 07:58:57 +0000
John Emmas <johne53 tiscali co uk> wrote:


On 6 Feb 2011, at 19:05, Nader Morshed wrote:

Thanks Nader.  Is this the document you mean:-

http://library.gnome.org/devel//gio/2.26/GFileInfo.html

Yep, or in particular:

http://library.gnome.org/devel/gio/2.26/GFileInfo.html#GFileInfo.description

g_file_query_info (pDestObject, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
                         G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
                         false, &error);

The API for g_file_query_info states that the 4th parameter should be a
GCancellable object or NULL, though in this case no error occurs
because false == 0 == NULL.

http://library.gnome.org/devel/gio/2.26/GFile.html#g-file-query-info

void SetHiddenAttribute (GFile* pFile, GFileInfo* pInfo, GError**
ppError) {
GError* error = NULL;

      g_file_info_set_is_hidden (pinfo,  true);

      g_file_set_attributes_from_info (pFile,  pInfo,
                         G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,  NULL,
&error);

      if (error)
            g_propagate_error (ppError, error);
}

I believe you can pass ppError directly to
g_file_set_attributes_from_info() in this case, as you just copy error
over anyways, but you might want to double-check that, it otherwise
looks fine.

However, the call to g_file_set_attributes_from_info() fails with
this error:-

error code 15  :  message=0x02894d80  "Setting attribute
standard::is-hidden not supported"

It seems that would be due to a rather crummy implementation of
GLocalFile which only handles getting the standard::is-hidden
attribute, not setting it:

http://git.gnome.org/browse/glib/tree/gio/glocalfileinfo.c#n2200

I might advise bugging your nearest glib developer to fix this :)

--
Nader Morshed <morshed nader gmail com>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]