[Mono-list] Getting mono path during runtime
jonpryor at vt.edu
Thu Jan 11 18:09:35 EST 2007
On Thu, 2007-01-11 at 17:44 -0500, Miguel de Icaza wrote:
> > I've scoured System.Reflection, but I'm probably in the wrong place.
> > Is there any way to get the path where mono is running from during
> > runtime? Would I need to use environment variables, or is there a
> > dynamic way to find that out in my csharp code?
> A Linux-only way of doing that would be to look at
> Which is a symbolic link to the actual executable; You can read the
> symlink using Mono.Posix.Native.readlink
Couldn't `typeof(int).Assembly.Location` (or some equivalent Assembly
property) be used? This would get the path to mscorlib.dll, which could
be used to ascertain the installation $prefix, leading to the `mono'
Of course this could be foiled if `configure --bin-path=...` were used
(so that it wasn't $prefix/bin), or if $prefix/lib/mono wasn't the GAC
location, but this would probably work 99% of the time...
More information about the Mono-list