Search code examples
wxwidgetsfilepath

wxWidgets: obtaining application path


How one can obtain path to module?

I am writing extension enclosed in a DLL and want to get path to my library in runtime.

Update

Of course first way worked fine

static wxString GetModulePath()
{
    static wxString path;

    WCHAR buf[512] = {0};
    GetModuleFileName(NULL, buf, 511);
    path = buf;

    return wxPathOnly(path);
}

but finally I ended with second one

wxStandardPaths sp;
wxLogError(sp.GetPluginsDir());

Solution

  • Have a look at the wxStandardPaths class. For your problem its GetExecutablePath() or GetPluginsDir() methods could be used - I'm just not sure what you want to do.