On Fri, 2002-07-19 at 16:33, Frederic Crozat wrote:
> Le ven 19/07/2002 à 17:19, Bastien Nocera a écrit :
> > Heya,
> >
> > Trying to rename a .desktop file's name to something that contains a '/'
> > doesn't work currently. Here's a patch to special-case .desktop files.
>
>
> > Index: nautilus-file.c
> > ===================================================================
> > RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.c,v
> > retrieving revision 1.294
> > diff -u -r1.294 nautilus-file.c
> > --- nautilus-file.c 2 Jul 2002 20:40:34 -0000 1.294
> > +++ nautilus-file.c 19 Jul 2002 15:12:32 -0000
> > @@ -981,8 +981,9 @@
> > g_return_if_fail (new_name != NULL);
> > g_return_if_fail (callback != NULL);
> >
> > - /* Return an error for incoming names containing path separators. */
> > - if (strstr (new_name, "/") != NULL) {
> > + /* Return an error for incoming names containing path separators.
> > + * But not for .desktop files as '/' are allowed for them */
> > + if (strstr (new_name, "/") != NULL && (nautilus_file_is_mime_type (file, "application/x-gnome-app-info") == FALSE)) {
>
> You should also test for "application/x-desktop", new .desktop files are
> seen like that.. (Fixed a bug in gnome-panel with the same problem..)
Fixed in attached patch.
Cheers
--
/Bastien Nocera
http://hadess.net
Index: nautilus-file.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.c,v
retrieving revision 1.294
diff -u -r1.294 nautilus-file.c
--- nautilus-file.c 2 Jul 2002 20:40:34 -0000 1.294
+++ nautilus-file.c 19 Jul 2002 15:34:58 -0000
@@ -981,8 +981,11 @@
g_return_if_fail (new_name != NULL);
g_return_if_fail (callback != NULL);
- /* Return an error for incoming names containing path separators. */
- if (strstr (new_name, "/") != NULL) {
+ /* Return an error for incoming names containing path separators.
+ * But not for .desktop files as '/' are allowed for them */
+ if (strstr (new_name, "/") != NULL
+ && (nautilus_file_is_mime_type (file, "application/x-gnome-app-info") == FALSE)
+ && (nautilus_file_is_mime_type (file, "application/x-desktop") == FALSE)) {
(* callback) (file, GNOME_VFS_ERROR_NOT_PERMITTED, callback_data);
return;
}
Attachment:
signature.asc
Description: This is a digitally signed message part