Re: [PATCH] Same filesystem drag-and-drop of a readonly file should gracefully degrade to a "copy"



On Mon, 2008-10-06 at 14:39 +0200, Nelson Benítez León wrote:
> 
>         
>         I think its generally better to go via
>         nautilus_file_get_existing() and
>         then nautilus_file_get_parent() since then we allocate one
>         less GFile
>         and terminate earlier in the doesn't-exist case.
> 
>  It allocates one less GFile pointer but one more NautilusFile
> pointer, don't know if that's a gain, I've changed it anyway... 

No, the parent one already exists in the cache.

>         Using is_writable isn't actually 100% correct, as on some
>         filesystem the
>         move attribute may not be controlled by the "writable" bit on
>         a
>         directory. For instance on a non-posix filesystem with a more
>         complicated permissions system. However, I think its good
>         enough, and if
>         you really want to move you can force via holding down the
>         move
>         modifier.
>         
> 
>   Ok, updated patch is attached.

Actually, to be a gigant pain in the ass here, but there is an even
better way. You should use nautilus_file_can_delete() on the source file
(not parent). 

This will require less code for you, and it will also be slightly more
accurate. For instance, it will work if the source file is in a writable
but sticky-bit directory (/tmp) but is not owned by you. It is also
possible for other backends to implement this in special ways if needed.




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