Skip to content

Instantly share code, notes, and snippets.

@koreus7
Created February 25, 2018 20:56
Show Gist options
  • Save koreus7/de662c69a8c70a2b4fd97d3f9bbdaac3 to your computer and use it in GitHub Desktop.
Save koreus7/de662c69a8c70a2b4fd97d3f9bbdaac3 to your computer and use it in GitHub Desktop.
Find PWD on OSX
#include <mach-o/dyld.h>
unsigned int bufferSize = 512;
std::vector<char> buffer(bufferSize + 1);
if(_NSGetExecutablePath(&buffer[0], &bufferSize))
{
buffer.resize(bufferSize);
_NSGetExecutablePath(&buffer[0], &bufferSize);
}
std::string s = &buffer[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment