GIO# FileFactory.NewForCommandlineArgs System.EntryPointNotFoundException

View: New views
3 Messages — Rating Filter:   Alert me  

GIO# FileFactory.NewForCommandlineArgs System.EntryPointNotFoundException

by Dan Saul :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have compiled Mono# from SVN to get access to GIO#. For the most part it works, I have no problem with the code:

base_dir = FileFactory.NewForPath(v);

However if I change it to

base_dir = FileFactory.NewForCommandlineArgs(v);

I would like to change this so that one can enter a URI or a Path on the command line.

I recieve the following exception:

Unhandled Exception: System.EntryPointNotFoundException: g_file_new_for_commandline_args
  at (wrapper managed-to-native) GLib.FileFactory:g_file_new_for_commandline_args (string)
  at GLib.FileFactory.NewForCommandlineArgs (System.String args) [0x00000]
  at DbModAddMovie.MainClass+<Main>c__AnonStorey0.<>m__0 (System.String v) [0x00000]
  at NDesk.Options.OptionSet+<>c__CompilerGenerated0.<Add>c__4[OptionValueCollection] (NDesk.Options.OptionValueCollection v) [0x00000]
  at (wrapper static-rgctx-invoke) NDesk.Options.OptionSet/<>c__CompilerGenerated0:static_rgctx_invoke_void__this___OptionValueCollection (NDesk.Options.OptionValueCollection)
  at NDesk.Options.OptionSet+ActionOption.OnParseComplete (NDesk.Options.OptionContext c) [0x00000]
  at NDesk.Options.Option.Invoke (NDesk.Options.OptionContext c) [0x00000]
  at NDesk.Options.OptionSet.ParseValue (System.String option, NDesk.Options.OptionContext c) [0x00000]
  at NDesk.Options.OptionSet.Parse (System.String argument, NDesk.Options.OptionContext c) [0x00000]
  at NDesk.Options.OptionSet.Parse (IEnumerable`1 arguments) [0x00000]
  at DbModAddMovie.MainClass.Main (System.String[] args) [0x00000]

Looking at the source svn://mono/gtk-sharp/gio/FileFactory.cs the two methods are the following:

        [DllImport ("libgio-2.0-0.dll")]
        private static extern IntPtr g_file_new_for_path (string path);
       
        public static File NewForPath (string path)
        {
            return GLib.FileAdapter.GetObject (g_file_new_for_path (path), false) as File;   
        }

        [DllImport ("libgio-2.0-0.dll")]
        private static extern IntPtr g_file_new_for_commandline_args (string args);

        public static File NewForCommandlineArgs (string args)
        {
            return GLib.FileAdapter.GetObject (g_file_new_for_commandline_args (args), false) as File;       
        }

I do not see a difference between them.

I am relatively new to C# so I do not know how to troubleshoot this. Would anyone be able to point me in the right direction?

Dan

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: GIO# FileFactory.NewForCommandlineArgs System.EntryPointNotFoundException

by Christian Hoff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, the GIO function is actually called g_file_new_for_commandline_arg
  ;-) . Attached is a simple patch to fix the issue(I think we can break
compatibility here since the old implementation was non-working).
Stephane, could you review? I assume the patch has to go into the
gio-sharp module as well?

Christian

Dan Saul wrote:

> Hi,
>
> I have compiled Mono# from SVN to get access to GIO#. For the most
> part it works, I have no problem with the code:
>
> base_dir = FileFactory.NewForPath(v);
>
> However if I change it to
>
> base_dir = FileFactory.NewForCommandlineArgs(v);
>
> I would like to change this so that one can enter a URI or a Path on
> the command line.
>
> I recieve the following exception:
>
> Unhandled Exception: System.EntryPointNotFoundException:
> g_file_new_for_commandline_args
>
> Dan
> ------------------------------------------------------------------------
>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@...
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>  

Index: gio/FileFactory.cs
===================================================================
--- gio/FileFactory.cs (Revision 136072)
+++ gio/FileFactory.cs (Arbeitskopie)
@@ -49,11 +49,11 @@
  }
 
  [DllImport ("libgio-2.0-0.dll")]
- private static extern IntPtr g_file_new_for_commandline_args (string args);
+ private static extern IntPtr g_file_new_for_commandline_arg (string arg);
 
- public static File NewForCommandlineArgs (string args)
+ public static File NewFromCommandlineArg (string arg)
  {
- return GLib.FileAdapter.GetObject (g_file_new_for_commandline_args (args), false) as File;
+ return GLib.FileAdapter.GetObject (g_file_new_for_commandline_arg (arg), false) as File;
  }
  }
 }

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: GIO# FileFactory.NewForCommandlineArgs System.EntryPointNotFoundException

by Stephane Delcroix-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 2009-06-14 at 09:44 +0200, Christian Hoff wrote:
> Yes, the GIO function is actually called g_file_new_for_commandline_arg
>   ;-) . Attached is a simple patch to fix the issue(I think we can break
> compatibility here since the old implementation was non-working).
> Stephane, could you review? I assume the patch has to go into the
> gio-sharp module as well?

applied, in both repositories. sorry for the original typo

s

>
> Christian
>
> Dan Saul wrote:
> > Hi,
> >
> > I have compiled Mono# from SVN to get access to GIO#. For the most
> > part it works, I have no problem with the code:
> >
> > base_dir = FileFactory.NewForPath(v);
> >
> > However if I change it to
> >
> > base_dir = FileFactory.NewForCommandlineArgs(v);
> >
> > I would like to change this so that one can enter a URI or a Path on
> > the command line.
> >
> > I recieve the following exception:
> >
> > Unhandled Exception: System.EntryPointNotFoundException:
> > g_file_new_for_commandline_args
> >
> > Dan
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Gtk-sharp-list maillist  -  Gtk-sharp-list@...
> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> >  
>

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list