Boost C++ Libraries: Ticket #12869: Getting the path of the current executable https://svn.boost.org/trac10/ticket/12869 <p> I couldn't find any other ticket relating to this issue, so I'm asking here. I think it would be <em>really</em> useful if Boost's <a class="missing wiki">FileSystem</a> included a method for getting the path of the current executable in a cross-platform way. I needed this kind of functionality myself just now because I needed to find some files relative to the executable's dir, and I think that a lot of projects can benefit from it. As goes without saying, a solution for this problem in a mature well-tested library beats a <em>quickfix</em> in one of my own projects. </p> <p> As has been noted in several threads on <a class="missing wiki">StackOverflow</a>, using <code>argv[0]</code> to derive the current path has its flaws on many platforms (including mine). A more robust solution would be to use e.g. <code>GetModuleFileName</code> on Windows and <code>/proc/self/exe/</code> on Linux. The code can I think be fairly easily copied from <a class="ext-link" href="http://stackoverflow.com/a/34109000/1173521"><span class="icon">​</span>this StackOverflow answer</a>, which, according to the author, has been tested on various platforms. </p> <p> Regards, Sam </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12869 Trac 1.4.3 anonymous Thu, 24 May 2018 15:08:08 GMT <link>https://svn.boost.org/trac10/ticket/12869#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12869#comment:1</guid> <description> <p> boost::dll::program_location() does exactly that? </p> </description> <category>Ticket</category> </item> </channel> </rss>