[Mono-list] Get binary directory in an mkbundle'd app
Robert Jordan
robertj at gmx.net
Mon May 12 07:56:17 UTC 2014
On 10.05.2014 23:35, cocowalla wrote:
> Yes, I'm afraid it's another mkbundle question :)
>
> I have an mkbundle'd app, and I need to get the directory of the binary (on
> Linux, if it matters).
>
> `Assembly.GetExecutingAssembly().CodeBase` doesn't work - it gives the path
> from where the binary was started, not the path in which the binary resides.
>
> `AppDomain.CurrentDomain.BaseDirectory` doesn't work - it gives the path
> from where the binary was started, not the path in which the binary resides.
>
> `Assembly.GetExecutingAssembly().Location` doesn't work - it just gives the
> binary name, rather than the path in which it resides.
>
> How can I get the directory in which the binary actually resides?
On Linux, resolve the symlink "/proc/self/exe" either via p/invoke
of readlink(2), or using Mono.Posix.
Robert
More information about the Mono-list
mailing list