title: Reliably get location of bundled executable on Linux
body: <p>I'm writing a C# application that's being compiled and bundled with Mono's <code>mkbundle</code>, and then run.</p>
  
  <p>I'm attempting to access the folder that the executable is being run in, which works when I run the application from the directory that it's in, using <code>./example</code>. However, when running it relatively from another directory, such as <code>../Builds/example</code>, it returns the wrong directory, instead returning the place it was executed from.</p>
  
  <p>This all works perfectly on Windows, however I also need it to work for Linux too.</p>
  
  <p>The methods I've previously tried are:</p>
  
  <ul>
  <li><code>AppDomain.Current.BaseDirectory</code></li>
  <li><code>Path.GetDirectoryName(Assembly.ExecutingAssembly().Location)</code> (also tried <code>EntryAssembly</code>)</li>
  </ul>
  
  <p>All of these return the incorrect directory, rather than the actual location of the executable.</p>