[Gtk-sharp-list] Drag and drop path
Mike Rhodes
Mike Rhodes <mike.rhodes@gmail.com>
Mon, 29 Nov 2004 22:01:45 +0000
I use this code:
[DllImport ("libgnomevfs-2.dll")]
private static extern IntPtr gnome_vfs_get_local_path_from_uri (string str);
public static string LocalPathFromUri (string uri)
{
IntPtr p = gnome_vfs_get_local_path_from_uri (uri);
if (p == IntPtr.Zero)
return null;
else
return GLib.Marshaller.PtrToStringGFree (p);
}
(All credit goes to the Muine code where I found it =) ) I believe
gnome-vfs isn't part of gtk-sharp as of yet, so I'm not sure of
another way to do it.
Mike.
p.s. btw, if you are thinking of writing a C# music player, I'm also
writing one; perhaps we could team up -- or at least solve some of the
issues that come up -- drop me a line off-list if you are interested!
On Mon, 29 Nov 2004 19:08:26 +0100, Christian Rudh
<lists-christian@rudh.se> wrote:
> Hi
>
> When drop a file on my application i get the URL in the following
> format:
>
> file:///home/user/song%20X.mp3
>
> To be able to pass it on to Gst# (for example) I have to remove the
> file:// part and replace %20 with spaces (that goes for other special
> characters to). Is there any simple way to decode the string to a normal
> Unix path? Like the System.Web.HttpUtility.HTMLDecode that MS .NET has?
--
"One should not aim at being possible to
understand but at being impossible to
misunderstand." - Quintilian