Re: [Mono-list] Mono.Unix.Magic libmagic wrapper

2006-09-23 Thread Jonathan Pryor
On Sat, 2006-09-23 at 10:59 -0400, Milosz Tanski wrote:
> The class name of Magic can be defiantly confusing/entertaining for
> the user who stumbles upon it for the first time. The other thing name
> that comes to my mind is FileMagicDatabase.

"Magic" shouldn't be in the name at all -- it's still confusing.

I would suggest using FileTypeDatabase.

> I've updated the bindings with the things you recommended, and I
> integrated it with the build system. I haven't tackled your point #4
> since I wasn't sure how to approach it exactly.

It may not be solvable.  Let's just assume that the magic database is
UTF-8 already...

> Index: class/Mono.Posix/Mono.Unix.Native/LibMagic.cs
> ===
> --- class/Mono.Posix/Mono.Unix.Native/LibMagic.cs   (revision 0)
> +++ class/Mono.Posix/Mono.Unix.Native/LibMagic.cs   (revision 0)
> @@ -0,0 +1,50 @@
> +using System;
> +using System.Runtime.InteropServices;
> +using Mono.Unix.Native;
> +
> +namespace Mono.Unix.Native
> +{
> +
> +[Flags]
> +public enum MAGIC_FLAGS

1. We shouldn't provide a low-level libmagic wrapper unless we have a
*really* compelling reason to do so.  (Syscall's "compelling reason" is
that it was written first, and not all of the Syscall methods are
wrapped within a higher-level class.  Neither of these apply here.)

2. Public types should be PascalCased.

3. The current policy is that Mono.Unix.Native wraps things within libc
(which "only" limits us to 2208 methods & whatever types they need).  At
present, no other library is wrapped (as far as it's concerned, though
the reality of xsetattr(2)'s presence within libc.so vs. libxattr.so is
open to debate...).

> Index: class/Mono.Posix/Mono.Unix/FileMagicDb.cs
> ===
> --- class/Mono.Posix/Mono.Unix/FileMagicDb.cs   (revision 0)
> +++ class/Mono.Posix/Mono.Unix/FileMagicDb.cs   (revision 0)
> @@ -0,0 +1,163 @@
> +using System;
> +using System.IO;
> +using System.Runtime.InteropServices;
> +using Mono.Unix.Native;
> +
> +namespace Mono.Unix {
> +
> +public class MagicDbException : Exception

use FileTypeDatabaseException.

> +{
> +string _text;
> +
> +public MagicDbException(string text) : base()
> +{
> +_text = text;
> +}
> +
> +override public string ToString()
> +{
> +return _text;
> +}
> +}
> +
> +public class FileMagicDb : IDisposable
> +{

Should be FileTypeDatabase.

> +IntPtr  _magic = IntPtr.Zero;
> +bool_followSymlinks = false;
> +
> +// open the magic database with default database files
> +public FileMagicDb(bool ReturnMime)

Do you need to make `ReturnMime' a constructor parameter?

It looks like you could call magic_setflags() to change whether the mime
type is returned -- will this work?  If this works, you could have a
GetMimeType() which would call magic_setflags(MAGIC_MIME) and then call
magic_file().

Alternatively, if the above won't work, creating a FileMimeTypeDatabase
sub-class might be useful, and make this constructor `internal'.

> +// open the magic database with a custom database file list
> +public FileMagicDb(bool ReturnMime, string[] dblist)

Should `dblist' be a `params' array?

> +~FileMagicDb()
> +{
> +if (_magic != IntPtr.Zero) {
> +LibMagic.magic_close(_magic);
> + _magic = IntPtr.Zero;
> +}
> +}

Code duplication is bad. :-)

Create a Close() method, and have both the finalizer and Dispose() call
this shared method.

> +public void AddDefaultDbFiles()
> +{
> +if (LibMagic.magic_load(_magic, null) != 0)
> +throw new MagicDbException(this.Error); 
> +}

Shouldn't this be called within the default constructor?

Use AddDefaultDatabaseFiles().

> +public void AddDbFile(string file)
> +{
> +if (LibMagic.magic_load(_magic, file) != 0)
> +throw new MagicDbException(this.Error); 
> +}

AddDatabaseFile().

> +public bool FollowSymlinks

FollowSymbolicLinks (consistency with the rest of Mono.Unix).

> +private string Error

LastError?

> +public string Lookup(string filename)

GetFileType().

> +public string Lookup(byte[] data)

GetTypeFromData().

> +static public string Mime(string filename)

GetDefaultFileMimeType().

> +{
> +string mime;
> +FileMagicDb m = new FileMagicDb(true);
> +
> +mime =
> Marshal.PtrToStringAuto(LibMagic.magic_file(m._magic, filename)); 
> +if (mime == null) {
> +throw new MagicDbException(m.Error);
> +}
> +
> +return mime;
> +}

Is libmagic thread safe?  If it is, you might consider using a static
instance instead of creating it an

Re: [Mono-list] Variable number of parameters to an indexer

2006-09-23 Thread Susan Mackay
\On 24/9/06 01:36, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> Re: [Mono-list] Variable number of parameters to an indexer

Robert,

Thank you for the fast response and the pointer to the bug report. Working
from the dates of the report and comments (Dec 05 and Jan 06), I'll be
re-architecting an alternative solution.

Susan


___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] GTK# problem

2006-09-23 Thread chris
Hi all,

I have a problem with an gtk# app. As soon as I define a signal, at this
stage it  is , in the glade.xml
file, the following Exception is raised:

Object reference not set to an instance of an object.

ConnectFunc()
Autoconnect()
Autoconnect()
.ctor()
Main()

My code looks like this:
---
using Gtk;
using Glade;
using System;

namespace Sharp
{
/// 
/// Description of MainWindow.
/// 
public class MainWindow
{
public MainWindow()
{
Glade.XML gxml = new Glade.XML(null, "Sharp.glade.xml", 
"mainGUI", null);
gxml.Autoconnect(this);
}

[STAThread]
public static void Main(string[] arg)
{
Application.Init();
new MainWindow();
Application.Run();
}

void on_mainGUI_delete_event(object o, DeleteEventArgs args)
{
Application.Quit();
args.RetVal = true;
}
}
}
---

All ideas appreciated.
Chris
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Mono.Unix.Magic libmagic wrapper

2006-09-23 Thread Milosz Tanski
Jonathan,

As far windows is concerned, there exists a native port of file and the
associated library at http://gnuwin32.sourceforge.net/packages/file.htm
. However, it doesn't seam that too many people or projects use it. I
don't have steady access to a win32 dev box to give it a whirl. So I'm
sure what do with the name space now... although Mono.Unix have the warm
fuzzy feeling of correctness/content.

The class name of Magic can be defiantly confusing/entertaining for the
user who stumbles upon it for the first time. The other thing name that
comes to my mind is FileMagicDatabase.

I'm willing to write the documentation as soon as this is done, and I
figure out how to do it...

I've updated the bindings with the things you recommended, and I
integrated it with the build system. I haven't tackled your point #4
since I wasn't sure how to approach it exactly.

Jonathan Pryor wrote:
> On Fri, 2006-09-22 at 23:25 -0400, Milosz Tanski wrote:
>> I wrote a wrapper for the unix libmagic library since it's very handy
>> sometimes (and I'm using this wrapper in my app right now, so I figured
>> might as well submit it). Sorry that's it's not a diff, but I'd know
>> exactly how to integrate it with the class library build system.
> 
> I have a few questions/concerns/observations:
> 
> 1.  Can libmagic be used on Windows without the use of Cygwin?  I think
> it can be, but I'm not entirely sure.  If it can be, I'm not sure that
> Mono.Unix is the best place for it (deliberately ignoring the Mono.Unix
> types which can work on Windows, Mono.Unix.Native.Stdlib &
> Mono.Unix.Native.StdioFileStream).  If libmagic can't work on Windows
> without Cygwin, then Mono.Unix is probably a reasonable spot for it.
> 
> 2.  I'm not fond of the name "Magic."  Yes, it's a `libmagic' wrapper,
> but for those who don't know what `libmagic' is, it's not a very
> informative name.  Considering that it's used by the file(1) command,
> I'm sure some better name could be found.  Perhaps FileTypeInfo?
> 
> Of course, any name would need to be "stand-alone"-ish, and not be
> easily confused with the existing UnixFileSystemInfo & UnixFileInfo
> types.
> 3.  The Magic.Descrition property should be Magic.Description.
> 
> 4.  You should get libmagic to generate UTF-8 (it it doesn't do so by
> default) and use UnixEncoding to do the UTF-8 -> string conversion (in
> case Mono's Marshal.PtrToStringAuto ever stops doing UTF-8, and there's
> a bug open to investigate that).
> 
> 5.  If it does get into Mono.Unix, the magic_* methods taking a filename
> should make use of the Mono.Unix.Native.FileNameMarshaler custom
> marshaler for "proper" filename transfers (for when a filename contains
> random binary data instead of being valid UTF-8).  See
> Mono.Unix.Native.Syscall.
> 
> 6.  Documentation -- are you willing to write it? :-)
>
> 
> Thank you for the file.
> 
>  - Jon
> 
> 

Index: class/Mono.Posix/Mono.Unix.Native/LibMagic.cs
===
--- class/Mono.Posix/Mono.Unix.Native/LibMagic.cs	(revision 0)
+++ class/Mono.Posix/Mono.Unix.Native/LibMagic.cs	(revision 0)
@@ -0,0 +1,50 @@
+using System;
+using System.Runtime.InteropServices;
+using Mono.Unix.Native;
+
+namespace Mono.Unix.Native
+{
+
+[Flags]
+public enum MAGIC_FLAGS
+{
+MAGIC_NONE  = 0,
+MAGIC_DEBUG = 1,
+MAGIC_SYMLINK   = 1 << 1,
+MAGIC_COMPRESS  = 1 << 2,
+MAGIC_DEVICES   = 1 << 3,
+MAGIC_MIME  = 1 << 4,
+MAGIC_CONTINUE  = 1 << 5,
+MAGIC_CHECK = 1 << 6,
+MAGIC_PRESERVE_ATIME= 1 << 7,
+MAGIC_RAW   = 1 << 8,
+MAGIC_ERROR = 1 << 9
+}
+
+public static class LibMagic
+{
+[DllImport("magic")]
+public extern static IntPtr magic_open(MAGIC_FLAGS flags);
+
+[DllImport("magic")]
+public extern static void magic_close(IntPtr magic_cookie);
+
+[DllImport("magic")]
+public extern static int magic_setflags(IntPtr magic_cookie, MAGIC_FLAGS flags);
+
+[DllImport("magic")]
+public extern static IntPtr magic_file(IntPtr magic_cookie,
+[MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileNameMarshaler))] string filename);
+
+[DllImport("magic")]
+public extern static IntPtr magic_buffer(IntPtr magic_cookie, Byte[] data, int len);
+
+[DllImport("magic")]
+public extern static IntPtr magic_error(IntPtr magic_cookie);
+
+[DllImport("magic")]
+public extern static int magic_load(IntPtr magic_cookie,
+ [MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileNameMarshaler))] string filename);
+
+}
+}
Index: class/Mono.Posix/Mono.Posix.dll.sources
=

Re: [Mono-list] Mono.Unix.Magic libmagic wrapper

2006-09-23 Thread Jonathan Pryor
On Fri, 2006-09-22 at 23:25 -0400, Milosz Tanski wrote:
> I wrote a wrapper for the unix libmagic library since it's very handy
> sometimes (and I'm using this wrapper in my app right now, so I figured
> might as well submit it). Sorry that's it's not a diff, but I'd know
> exactly how to integrate it with the class library build system.

I have a few questions/concerns/observations:

1.  Can libmagic be used on Windows without the use of Cygwin?  I think
it can be, but I'm not entirely sure.  If it can be, I'm not sure that
Mono.Unix is the best place for it (deliberately ignoring the Mono.Unix
types which can work on Windows, Mono.Unix.Native.Stdlib &
Mono.Unix.Native.StdioFileStream).  If libmagic can't work on Windows
without Cygwin, then Mono.Unix is probably a reasonable spot for it.

2.  I'm not fond of the name "Magic."  Yes, it's a `libmagic' wrapper,
but for those who don't know what `libmagic' is, it's not a very
informative name.  Considering that it's used by the file(1) command,
I'm sure some better name could be found.  Perhaps FileTypeInfo?

Of course, any name would need to be "stand-alone"-ish, and not be
easily confused with the existing UnixFileSystemInfo & UnixFileInfo
types.

3.  The Magic.Descrition property should be Magic.Description.

4.  You should get libmagic to generate UTF-8 (it it doesn't do so by
default) and use UnixEncoding to do the UTF-8 -> string conversion (in
case Mono's Marshal.PtrToStringAuto ever stops doing UTF-8, and there's
a bug open to investigate that).

5.  If it does get into Mono.Unix, the magic_* methods taking a filename
should make use of the Mono.Unix.Native.FileNameMarshaler custom
marshaler for "proper" filename transfers (for when a filename contains
random binary data instead of being valid UTF-8).  See
Mono.Unix.Native.Syscall.

6.  Documentation -- are you willing to write it? :-)

Thank you for the file.

 - Jon


___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Variable number of parameters to an indexer

2006-09-23 Thread Robert Jordan
Robert Jordan wrote:
> Susan Mackay wrote:
>> (My apologies if this is a duplicate - it didn't seem to be included the
>> first time)
>>
>>
>> I have some code that was originally developed under VS2003 and VS2005 (long
>> development time!). I'm trying to port it over to the mono environment.
> 
> A self-contained test case:
> 
> class T
> {
>  public int this [params int[] values]
>  {
>  get { return 42; }
>  set { }
>  }
> 
>  public static void Main ()
>  {
>  new T () [1, 2] = 3; // error CS1501
>  }
> }
> 
> It seems that [g]mcs doesn't lookup 'set_Item' correctly.


http://bugzilla.ximian.com/show_bug.cgi?id=77014

Robert

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Variable number of parameters to an indexer

2006-09-23 Thread Robert Jordan
Susan Mackay wrote:
> (My apologies if this is a duplicate - it didn't seem to be included the
> first time)
> 
> 
> I have some code that was originally developed under VS2003 and VS2005 (long
> development time!). I'm trying to port it over to the mono environment.

A self-contained test case:

class T
{
 public int this [params int[] values]
 {
 get { return 42; }
 set { }
 }

 public static void Main ()
 {
 new T () [1, 2] = 3; // error CS1501
 }
}

It seems that [g]mcs doesn't lookup 'set_Item' correctly.

Robert

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Variable number of parameters to an indexer

2006-09-23 Thread Susan Mackay
(My apologies if this is a duplicate - it didn't seem to be included the
first time)


I have some code that was originally developed under VS2003 and VS2005 (long
development time!). I'm trying to port it over to the mono environment.

It contains the following indexer in a class:

public virtual DimensionedValue this[ params int[] Indicies]
{
get
{
...
}
set 
{
...
}
}

Previously this has worked with code such as:

   for( int Index = 0; Index < ExpLength; Index++)
   {
   Expression Exp = ExpList[ Index];
   DimensionedValue DV = (DimensionedValue)Exp;
   VR[Index] = DV;
   }

where VR is a class derived from the class with the above virtual indexer.
(I've split the code up onto several lines to try to figure out the problem
- it normally is a one-line assignment).

The last code line (VR[Index] = DV) generates the error messages

error CS1502: The best overloaded method match for
`ExpressionLib.Value.this[params int[]]' has some invalid arguments
error CS1615: Argument `1' should not be passed with the `' keyword
error CS1501: No overload for method `this' takes `1' arguments

(I've edited out the file name and line/column references from the message)

Can someone please explain the error messages, in particular the second one?

Also, is this something that VS is allowing and mono is not because it is
not really valid C# - or something?

Thanks

Susan

(BTW: what I'm trying to do is be able to express multi-dimensional values
that can have any number of dimensions without this being defined at
compile-time. I could have an indexer with 1 value, one with 2 values, one
with 3 etc but I am trying to make this generic, which I don't think I can
do with specific-parameter indexers).


___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Mono.Unix.Magic libmagic wrapper

2006-09-23 Thread Milosz Tanski
Hi everyone,

I wrote a wrapper for the unix libmagic library since it's very handy
sometimes (and I'm using this wrapper in my app right now, so I figured
might as well submit it). Sorry that's it's not a diff, but I'd know
exactly how to integrate it with the class library build system.

Right now the API it exposes is more in spirit of the .net FileInfo
style classes then the original Unix library.

I think it'd be a worthy addition to Mono.Unix, if there's a possibility
for getting it included let me know what changes (if any) there need to
be made.

Thanks.


Milosz.
//
// Mono.Unix/Magic.cs
//
// Authors:
//   Milosz Tanski ([EMAIL PROTECTED])
//
// (C) 2004-2006 Milosz Tanski
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using System.Runtime.InteropServices;


namespace Mono.Unix {

public class MagicException : Exception
{
string _text;

public MagicException(string text) : base()
{
_text = text;
}

override public string ToString()
{
return _text;
}
}

public class Magic : IDisposable
{
IntPtr  _magic = IntPtr.Zero;
bool_followSymlinks = false;

// open the magic database with default database files
public Magic(bool ReturnMime)
{
_magic = magic_open((ReturnMime) ? DefaultFlags | MAGIC_FLAGS.MAGIC_MIME : DefaultFlags);
if (_magic == IntPtr.Zero)
throw new MagicException("Unable to open the magic database");

if (magic_load(_magic, null) != 0)
throw new MagicException(this.Error);

}

// open the magic database with a custom database file list
public Magic(bool ReturnMime, string[] dblist)
{
_magic = magic_open((ReturnMime) ? DefaultFlags | MAGIC_FLAGS.MAGIC_MIME : DefaultFlags);
if (_magic == IntPtr.Zero)
throw new MagicException("Unable to open the magic database");

foreach(string file in dblist) {
if (magic_load(_magic, file) != 0)
throw new MagicException(this.Error);
}

}

~Magic()
{
if (_magic != IntPtr.Zero) {
magic_close(_magic);
 _magic = IntPtr.Zero;
}
}

public void Dispose ()
{
if (_magic != IntPtr.Zero) {
magic_close(_magic);
_magic = IntPtr.Zero;
}

GC.SuppressFinalize(this);
}

public void AddDefaultDbFiles()
{
if (magic_load(_magic, null) != 0)
throw new MagicException(this.Error); 
}

public void AddDbFile(string file)
{
if (magic_load(_magic, file) != 0)
throw new MagicException(this.Error); 
}

public bool FollowSymlinks
{
get {
return _followSymlinks;
}

set {
magic_setflags(_magic, (value) ? DefaultFlags | MAGIC_FLAGS.MAGIC_MIME : DefaultFlags);
_followSymlinks = value;
}

}

private string Error
{
get {
return Marshal.PtrToStringAuto(magic_error(_magic));
}
}

public string Lookup(string filename)
{
string text;

text = Marshal.PtrToStringAuto(magic_file(_magic, filename));
if (text == null)
throw new MagicException(this.Error);

return text;
}

public string Lookup(FileInfo fi)
{
return Lookup(fi.FullName);
}

public string Lookup(byte[] data)
{
string text;

text = Marshal.PtrToStringAuto(magic_buffer(_magic, data, dat

Re: [Mono-list] ASP.NET and MySQL

2006-09-23 Thread Brown, Robert
Have you tried specifying the port in the connection string?
-=Robert

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Loren Bandiera
Sent: Friday, September 22, 2006 12:23 PM
To: mono-list
Subject: [Mono-list] ASP.NET and MySQL


Hi,

I'm trying to get an ASP.NET application working with Mono running under
Linux. I want to use MySQL for the database so I got the MySQL
Connector/Net 1.0.7.

If I write a small command line program that just does this:

MySqlConnection conn = new MySqlConnection("Server=;Database=foo;User ID=test;Password=test;Pooling=false");
conn.Open ();
Console.WriteLine(conn.ServerVersion);

That works fine. It connects to the remote server and prints out the
server version (5.0.24a-log). 

However, if write a small ASP.NET form and try and execute that same
code from Page_load() it fails. This is the trace that xsp2 gives me:

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the
specified MySQL hosts ---> System.Net.Sockets.SocketException: No such
host is known
  at System.Net.Dns.GetHostByName (System.String hostName) [0x0]
  at MySql.Data.Common.StreamCreator.GetStream (Int32 timeOut) [0x0]
  at MySql.Data.MySqlClient.NativeDriver.Open () [0x0] --- End of
inner exception stack trace ---

  at MySql.Data.MySqlClient.NativeDriver.Open () [0x0]
  at MySql.Data.MySqlClient.Driver.Create
(MySql.Data.MySqlClient.MySqlConnectionString settings) [0x0]
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x0] 

I'm at a loss for why it works from the command line but not from within
an ASP page. It's the same connection string, server, etc.

Anyone seen this behavior before? Got any suggestions?

--
Loren Bandiera <[EMAIL PROTECTED]>
MMG Security, Inc.

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


The content of this e-mail message and any attachments are confidential
and may be legally privileged, intended solely for the addressee. If you
are not the intended recipient, be advised that any use, dissemination,
distribution, or copying of this e-mail is strictly prohibited.  If you
receive this message in error, please notify the sender immediately by
reply email and destroy the message and its attachments.

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] External processes and Paths

2006-09-23 Thread Rob Brown-Bayliss
On 9/23/06, Robert Jordan <[EMAIL PROTECTED]> wrote:
> Rob Brown-Bayliss wrote:
> > Hi, I am having a path problem when running an external process.  The
> > problem is that the application I am atempting to start is in the path
> > as given by the error, but then it suggests I check the path.
> >
> [...]
> >   gconftool.FileName = "gconftool-2 ";
>
> Remove the trailing space from the file name.
>

Excellent, thank you!



-- 
Rob
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] External processes and Paths

2006-09-23 Thread Robert Jordan
Rob Brown-Bayliss wrote:
> Hi, I am having a path problem when running an external process.  The
> problem is that the application I am atempting to start is in the path
> as given by the error, but then it suggests I check the path.
> 
[...]
>   gconftool.FileName = "gconftool-2 ";

Remove the trailing space from the file name.

Robert

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] External processes and Paths

2006-09-23 Thread Rob Brown-Bayliss
Hi, I am having a path problem when running an external process.  The
problem is that the application I am atempting to start is in the path
as given by the error, but then it suggests I check the path.

Here is the error:

ApplicationName='gconftool-2 ', CommandLine=' -a /apps/',
CurrentDirectory='',
PATH='/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/rob/bin'.
Check the path.

And locate shows:

[EMAIL PROTECTED] ~]$ locate gconftool-2
/usr/bin/gconftool-2
/usr/share/man/man1/gconftool-2.1.gz
[EMAIL PROTECTED] ~]$

And here is the offending code:

Console.WriteLine ("===");
StringBuilder opts = new StringBuilder();
opts.Append (" -a ");
opts.Append (path);
ProcessStartInfo gconftool = new ProcessStartInfo();
gconftool.FileName = "gconftool-2 ";
gconftool.Arguments = opts.ToString();
gconftool.RedirectStandardOutput = true;
gconftool.UseShellExecute = false;
Console.WriteLine ("starting");
Process process = Process.Start (gconftool);
Console.WriteLine ("redirecting");
System.IO.StreamReader output = process.StandardOutput;
Console.WriteLine ("waiting");
process.WaitForExit();
Console.WriteLine (output.ReadToEnd());


Does any one have an idea as to why this is failing and where I could
start looking?

thanks

-- 
Rob
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list